diff options
Diffstat (limited to 'debian/patches/pr61046.diff')
-rw-r--r-- | debian/patches/pr61046.diff | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/patches/pr61046.diff b/debian/patches/pr61046.diff new file mode 100644 index 0000000..f303f43 --- /dev/null +++ b/debian/patches/pr61046.diff @@ -0,0 +1,50 @@ +# DP: Fix PR c++/61046, taken from the trunk. + +gcc/cp/ + +2014-06-02 Jason Merrill <jason@redhat.com> + + PR c++/61046 + * decl.c (reshape_init_class): Handle un-folded + constant-expressions. + +--- a/src/gcc/testsuite/g++.dg/ext/desig7.C ++++ a/src/gcc/testsuite/g++.dg/ext/desig7.C +@@ -0,0 +1,8 @@ ++// PR c++/61046 ++ ++struct A ++{ ++ int ary[4]; ++}; ++const int i = 0; ++A bar = { [i] = 0 }; // { dg-error "designated" } +--- a/src/gcc/cp/decl.c ++++ a/src/gcc/cp/decl.c +@@ -5294,7 +5294,12 @@ + 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 @@ + 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) |