diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-03-16 09:05:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-03-16 09:05:06 +0100 |
commit | 828fd2fbe88ee6adb16b708d584caf96237046da (patch) | |
tree | 81a5f7d4c499c01ce8318c0eb2dc2855b3f87e64 /gcc/cp | |
parent | 9f3599c044810c4fd17f1f36ec024c55a35021fd (diff) | |
download | gcc-828fd2fbe88ee6adb16b708d584caf96237046da.zip gcc-828fd2fbe88ee6adb16b708d584caf96237046da.tar.gz gcc-828fd2fbe88ee6adb16b708d584caf96237046da.tar.bz2 |
re PR c++/84874 (internal compiler error: in reshape_init_class, at cp/decl.c:5800)
PR c++/84874
* decl.c (reshape_init_class): Don't assert d->cur->index == field
if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
* g++.dg/cpp2a/desig7.C: New test.
From-SVN: r258585
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 13 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a4f845a..7322a76 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-03-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/84874 + * decl.c (reshape_init_class): Don't assert d->cur->index == field + if d->cur->index is a FIELD_DECL, instead set field to d->cur->index. + 2018-03-15 Jakub Jelinek <jakub@redhat.com> PR c++/84222 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 98f762e..727bb04 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5885,8 +5885,17 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p, return error_mark_node; if (TREE_CODE (d->cur->index) == FIELD_DECL) - /* We already reshaped this. */ - gcc_assert (d->cur->index == field); + { + /* We already reshaped this. */ + if (field != d->cur->index) + { + tree id = DECL_NAME (d->cur->index); + gcc_assert (id); + gcc_checking_assert (d->cur->index + == get_class_binding (type, id, false)); + field = d->cur->index; + } + } else if (TREE_CODE (d->cur->index) == IDENTIFIER_NODE) field = get_class_binding (type, d->cur->index, false); else |