diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-03 04:57:39 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-03 04:57:39 +0000 |
commit | ebcc7e92dfdfee12c34282c36b82a463f9b5003d (patch) | |
tree | b5ec0e160827f7b27902acaa13319454c927cc46 /gcc/cp | |
parent | 4e26e30f067bc8f66c2fc9718a01064d67947b20 (diff) | |
download | gcc-ebcc7e92dfdfee12c34282c36b82a463f9b5003d.tar.gz |
PR c++/61046
* decl.c (reshape_init_class): Handle un-folded
constant-expressions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211160 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 13 |
2 files changed, 10 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e57edc5a14c..fae8da1fb25 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-06-02 Jason Merrill <jason@redhat.com> + PR c++/61046 + * decl.c (reshape_init_class): Handle un-folded + constant-expressions. + PR c++/61134 * pt.c (pack_deducible_p): Handle canonicalization. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c61ad68f92b..8dc5f1fa9f4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5294,7 +5294,12 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p, if (d->cur->index == error_mark_node) return error_mark_node; - if (TREE_CODE (d->cur->index) == INTEGER_CST) + if (TREE_CODE (d->cur->index) == FIELD_DECL) + /* We already reshaped this. */ + gcc_assert (d->cur->index == field); + else if (TREE_CODE (d->cur->index) == IDENTIFIER_NODE) + field = lookup_field_1 (type, d->cur->index, /*want_type=*/false); + else { if (complain & tf_error) error ("%<[%E] =%> used in a GNU-style designated initializer" @@ -5302,12 +5307,6 @@ 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); - else - field = lookup_field_1 (type, d->cur->index, /*want_type=*/false); - if (!field || TREE_CODE (field) != FIELD_DECL) { if (complain & tf_error) |