* init.c (perform_member_init): Cope with uninstantiated NSDMI.

From-SVN: r184877
This commit is contained in:
Jason Merrill 2012-03-03 19:55:51 -05:00 committed by Jason Merrill
parent 743af85b75
commit a491b7be7f
4 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,7 @@
2012-03-03 Jason Merrill <jason@redhat.com>
* init.c (perform_member_init): Cope with uninstantiated NSDMI.
Core 1270
* call.c (build_aggr_conv): Call reshape_init.
(convert_like_real): Likewise.

View File

@ -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

View File

@ -1,5 +1,7 @@
2012-03-03 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/nsdmi-defer6.C: New.
Core 1270
* g++.dg/cpp0x/initlist65.C: New.

View File

@ -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;