+2014-09-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/61489
+ * doc/invoke.texi ([-Wmissing-field-initializers]): Update.
+
2014-09-11 Alan Lawrence <alan.lawrence@arm.com>
* config/aarch64/aarch64-builtins.c (aarch64_types_unop_su_qualifiers,
+2014-09-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/61489
+ * typeck2.c (process_init_constructor_record): Do not warn about
+ missing field initializer if EMPTY_CONSTRUCTOR_P (init).
+
2014-09-11 Jason Merrill <jason@redhat.com>
PR c++/63139
next = massage_init_elt (TREE_TYPE (field), next, complain);
/* Warn when some struct elements are implicitly initialized. */
- if (complain & tf_warning)
+ if ((complain & tf_warning)
+ && !EMPTY_CONSTRUCTOR_P (init))
warning (OPT_Wmissing_field_initializers,
"missing initializer for member %qD", field);
}
/* Warn when some struct elements are implicitly initialized
to zero. */
- if (complain & tf_warning)
+ if ((complain & tf_warning)
+ && !EMPTY_CONSTRUCTOR_P (init))
warning (OPT_Wmissing_field_initializers,
"missing initializer for member %qD", field);
struct s x = @{ .f = 3, .g = 4 @};
@end smallexample
+In C++ this option does not warn either about the empty @{ @}
+initializer, for example:
+
+@smallexample
+struct s @{ int f, g, h; @};
+s x = @{ @};
+@end smallexample
+
This warning is included in @option{-Wextra}. To get other @option{-Wextra}
warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
+2014-09-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/61489
+ * g++.dg/warn/Wmissing-field-initializers-1.C: New.
+ * g++.old-deja/g++.other/warn5.C: Adjust.
+
2014-09-11 Alan Lawrence <alan.lawrence@arm.com>
* gcc.target/aarch64/vset_lane_1.c: New test.
--- /dev/null
+// PR c++/61489
+// { dg-options "-Wmissing-field-initializers" }
+
+struct mystruct1 {
+ int a, b;
+};
+
+struct aux2 {
+ aux2();
+};
+
+struct mystruct2 {
+ aux2 a, b;
+};
+
+struct aux3 {
+ int x;
+};
+
+struct mystruct3 {
+ aux3 a, b;
+};
+
+mystruct1 obj11 = {};
+mystruct1 obj12 = {0}; // { dg-warning "missing initializer" }
+
+mystruct2 obj21 = {};
+mystruct2 obj22 = {aux2()}; // { dg-warning "missing initializer" }
+
+mystruct3 obj31 = {};
+mystruct3 obj32 = {0}; // { dg-warning "missing initializer" }
return new X (); // gets bogus warning
}
-X x = {}; // { dg-warning "" } missing initializer
+X x = {};