This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/86917] [7/8/9 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:2798
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 23 Nov 2018 18:55:10 +0000
- Subject: [Bug c++/86917] [7/8/9 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:2798
- Auto-submitted: auto-generated
- References: <bug-86917-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86917
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The last class' array can have even just a single element, like:
struct A
{
constexpr A () : c (0) {}
static const A z;
unsigned c;
};
struct B
{
typedef A W[4];
constexpr B () : w ({ A::z, A::z, A::z, A::z }) {}
W w;
};
struct C
{
C ();
B w[1];
};
C::C ()
{
}
cxx_eval_array_reference is called with an ARRAY_REF {z, z, z, z}[0] and
ctx->ctor is properly a CONSTRUCTOR with A type.
The innermost ctx->ctor is created when calling cxx_eval_constant_expression
on TARGET_EXPR <D.2193, *(struct A &) (struct A *) NON_LVALUE_EXPR <(struct A
&) &{z, z, z, z}[0]>>;
So, should something have cleared ctx->ctor again, should
cxx_eval_array_reference (but cxx_eval_component_reference is similar) create
new context and build new new_ctx.ctor, or is ARRAY_REF of a CONSTRUCTOR not
expected to appear?