diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-02-15 23:05:12 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-02-15 23:05:12 +0100 |
commit | f0516ca404ec64ddf9ab465b73077d672ee52fd4 (patch) | |
tree | e6cf6cc5c66bd98f21ac96313f328ee00a993f03 /gcc/cp | |
parent | ba6b3795d4d7fe18b27a467f7d96051b5b55ace2 (diff) | |
download | gcc-f0516ca404ec64ddf9ab465b73077d672ee52fd4.zip gcc-f0516ca404ec64ddf9ab465b73077d672ee52fd4.tar.gz gcc-f0516ca404ec64ddf9ab465b73077d672ee52fd4.tar.bz2 |
re PR c++/69658 (Bogus "C99 designator outside aggregate initializer" error)
PR c++/69658
* init.c (expand_default_init): Only call reshape_init
in the direct-initialization from an initializer list case.
* g++.dg/init/pr69658.C: New test.
From-SVN: r233435
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/init.c | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 04d55bc..51c99e1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-02-15 Jakub Jelinek <jakub@redhat.com> + + PR c++/69658 + * init.c (expand_default_init): Only call reshape_init + in the direct-initialization from an initializer list case. + 2016-02-15 Jason Merrill <jason@redhat.com> PR c++/69753 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index f6ceb7f..9f9c729 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1636,16 +1636,17 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags, gcc_checking_assert ((flags & LOOKUP_ONLYCONVERTING) == 0 && TREE_CHAIN (init) == NULL_TREE); init = TREE_VALUE (init); + /* Only call reshape_init if it has not been called earlier + by the callers. */ + if (BRACE_ENCLOSED_INITIALIZER_P (init) && CP_AGGREGATE_TYPE_P (type)) + init = reshape_init (type, init, complain); } if (init && BRACE_ENCLOSED_INITIALIZER_P (init) && CP_AGGREGATE_TYPE_P (type)) /* A brace-enclosed initializer for an aggregate. In C++0x this can happen for direct-initialization, too. */ - { - init = reshape_init (type, init, complain); - init = digest_init (type, init, complain); - } + init = digest_init (type, init, complain); /* A CONSTRUCTOR of the target's type is a previously digested initializer, whether that happened just above or in |