Commit 1bdbef09 by Marek Polacek Committed by 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
parent 3b8acdf9
2018-03-21 Marek Polacek <polacek@redhat.com>
PR c++/71638, ICE with NSDMI and reference.
* constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
even when we replace an element.
2018-03-20 Marek Polacek <polacek@redhat.com>
PR c++/84978, ICE with NRVO.
......
......@@ -2873,16 +2873,17 @@ cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t,
gcc_assert (is_empty_class (TREE_TYPE (TREE_TYPE (index))));
changed = true;
}
else if (new_ctx.ctor != ctx->ctor)
else
{
if (new_ctx.ctor != ctx->ctor)
{
/* We appended this element above; update the value. */
gcc_assert ((*p)->last().index == index);
(*p)->last().value = elt;
}
else
{
CONSTRUCTOR_APPEND_ELT (*p, index, elt);
/* Adding an element might change the ctor's flags. */
/* Adding or replacing an element might change the ctor's flags. */
TREE_CONSTANT (ctx->ctor) = constant_p;
TREE_SIDE_EFFECTS (ctx->ctor) = side_effects_p;
}
......
2018-03-21 Marek Polacek <polacek@redhat.com>
PR c++/71638, ICE with NSDMI and reference.
* g++.dg/cpp0x/nsdmi14.C: New test.
* g++.dg/cpp1y/nsdmi-aggr10.C: New test.
2018-03-21 Chenghua Xu <paul.hua.gm@gmail.com>
* gcc.dg/vect/vect-strided-shift-1.c: Add dg-skip-if for
......
// PR c++/71638
// { dg-do compile { target c++11 } }
// { dg-options "-Wall" }
struct A {
struct {
int i;
int &j = i;
} b;
int a = b.j;
};
void bar (A);
void
foo ()
{
bar (A{});
}
// PR c++/71638
// { dg-do compile { target c++14 } }
struct {
int &&a;
int b{a};
} c[] { { 2 } };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment