commit 46131bcba27d82f43a26daa12a8c8e95f7208696
Author: Jason Merrill <jason@redhat.com>
Date: Mon Feb 20 06:15:24 2012 -0500
* init.c (perform_member_init): Cope with uninstantiated NSDMI.
@@ -540,6 +540,12 @@ perform_member_init (tree member, tree init)
else
{
init = DECL_INITIAL (member);
+ if (init && TREE_CODE (init) == DEFAULT_ARG)
+ {
+ error ("constructor required before non-static data member "
+ "for %qD has been parsed", member);
+ init = NULL_TREE;
+ }
/* Strip redundant TARGET_EXPR so we don't need to remap it, and
so the aggregate init code below will see a CONSTRUCTOR. */
if (init && TREE_CODE (init) == TARGET_EXPR
new file mode 100644
@@ -0,0 +1,8 @@
+// { dg-do compile { target c++11 } }
+
+struct A // { dg-error "non-static data member" }
+{
+ int i = (A(), 42); // { dg-message "required here" }
+};
+
+A a;