===================================================================
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+class foo {
+public:
+ foo();
+};
+
+class bar: public foo { // { dg-error "uninitialized" }
+ // { dg-message "implicitly deleted" "" { target c++11 } 8 }
+private:
+ int const a; // { dg-message "should be initialized" }
+};
+
+foo::foo() {
+}
+
+int main(int argc, char **argv)
+{
+ bar x; // { dg-error "deleted" "" { target c++11 } }
+ // { dg-message "synthesized" "" { target { ! c++11 } } 19 }
+}
===================================================================
@@ -6,9 +6,10 @@ public:
foo();
};
-class bar: public foo { // { dg-error "reference|bar::bar" }
+class bar: public foo { // { dg-error "uninitialized" }
+ // { dg-message "implicitly deleted" "" { target c++11 } 9 }
private:
- int &a;
+ int &a; // { dg-message "should be initialized" }
};
foo::foo() {
@@ -16,5 +17,6 @@ foo::foo() {
int main(int argc, char **argv)
{
- bar x; // { dg-message "synthesized|deleted" }
+ bar x; // { dg-error "deleted" "" { target c++11 } }
+ // { dg-message "synthesized" "" { target { ! c++11 } } 20 }
}
===================================================================
@@ -710,13 +710,19 @@ perform_member_init (tree member, tree i
tree core_type;
/* member traversal: note it leaves init NULL */
if (TREE_CODE (type) == REFERENCE_TYPE)
- permerror (DECL_SOURCE_LOCATION (current_function_decl),
- "uninitialized reference member %qD",
- member);
+ {
+ permerror (DECL_SOURCE_LOCATION (current_function_decl),
+ "uninitialized reference member in %q#T", type);
+ inform (DECL_SOURCE_LOCATION (member),
+ "%q#D should be initialized", member);
+ }
else if (CP_TYPE_CONST_P (type))
- permerror (DECL_SOURCE_LOCATION (current_function_decl),
- "uninitialized member %qD with %<const%> type %qT",
- member, type);
+ {
+ permerror (DECL_SOURCE_LOCATION (current_function_decl),
+ "uninitialized const member in %q#T", type);
+ inform (DECL_SOURCE_LOCATION (member),
+ "%q#D should be initialized", member );
+ }
core_type = strip_array_types (type);