GCC with patches for OS216
Revision | 1bdbef090299990b1fdef6323bb3daa48acf9349 (tree) |
---|---|
Time | 2018-03-21 16:09:22 |
Author | Marek Polacek <polacek@redh...> |
Commiter | Marek Polacek |
PR c++/71638, ICE with NSDMI and reference.
* constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
even when we replace an element.
* g++.dg/cpp0x/nsdmi14.C: New test.
* g++.dg/cpp1y/nsdmi-aggr10.C: New test.
From-SVN: r258703
@@ -1,3 +1,9 @@ | ||
1 | +2018-03-21 Marek Polacek <polacek@redhat.com> | |
2 | + | |
3 | + PR c++/71638, ICE with NSDMI and reference. | |
4 | + * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags | |
5 | + even when we replace an element. | |
6 | + | |
1 | 7 | 2018-03-20 Marek Polacek <polacek@redhat.com> |
2 | 8 | |
3 | 9 | PR c++/84978, ICE with NRVO. |
@@ -2873,16 +2873,17 @@ cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t, | ||
2873 | 2873 | gcc_assert (is_empty_class (TREE_TYPE (TREE_TYPE (index)))); |
2874 | 2874 | changed = true; |
2875 | 2875 | } |
2876 | - else if (new_ctx.ctor != ctx->ctor) | |
2877 | - { | |
2878 | - /* We appended this element above; update the value. */ | |
2879 | - gcc_assert ((*p)->last().index == index); | |
2880 | - (*p)->last().value = elt; | |
2881 | - } | |
2882 | 2876 | else |
2883 | 2877 | { |
2884 | - CONSTRUCTOR_APPEND_ELT (*p, index, elt); | |
2885 | - /* Adding an element might change the ctor's flags. */ | |
2878 | + if (new_ctx.ctor != ctx->ctor) | |
2879 | + { | |
2880 | + /* We appended this element above; update the value. */ | |
2881 | + gcc_assert ((*p)->last().index == index); | |
2882 | + (*p)->last().value = elt; | |
2883 | + } | |
2884 | + else | |
2885 | + CONSTRUCTOR_APPEND_ELT (*p, index, elt); | |
2886 | + /* Adding or replacing an element might change the ctor's flags. */ | |
2886 | 2887 | TREE_CONSTANT (ctx->ctor) = constant_p; |
2887 | 2888 | TREE_SIDE_EFFECTS (ctx->ctor) = side_effects_p; |
2888 | 2889 | } |
@@ -1,3 +1,9 @@ | ||
1 | +2018-03-21 Marek Polacek <polacek@redhat.com> | |
2 | + | |
3 | + PR c++/71638, ICE with NSDMI and reference. | |
4 | + * g++.dg/cpp0x/nsdmi14.C: New test. | |
5 | + * g++.dg/cpp1y/nsdmi-aggr10.C: New test. | |
6 | + | |
1 | 7 | 2018-03-21 Chenghua Xu <paul.hua.gm@gmail.com> |
2 | 8 | |
3 | 9 | * gcc.dg/vect/vect-strided-shift-1.c: Add dg-skip-if for |
@@ -0,0 +1,19 @@ | ||
1 | +// PR c++/71638 | |
2 | +// { dg-do compile { target c++11 } } | |
3 | +// { dg-options "-Wall" } | |
4 | + | |
5 | +struct A { | |
6 | + struct { | |
7 | + int i; | |
8 | + int &j = i; | |
9 | + } b; | |
10 | + int a = b.j; | |
11 | +}; | |
12 | + | |
13 | +void bar (A); | |
14 | + | |
15 | +void | |
16 | +foo () | |
17 | +{ | |
18 | + bar (A{}); | |
19 | +} |
@@ -0,0 +1,7 @@ | ||
1 | +// PR c++/71638 | |
2 | +// { dg-do compile { target c++14 } } | |
3 | + | |
4 | +struct { | |
5 | + int &&a; | |
6 | + int b{a}; | |
7 | +} c[] { { 2 } }; |