[Bug c++/86917] [7/8/9 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:2798

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 23 18:55:00 GMT 2018


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?


More information about the Gcc-bugs mailing list