https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108309

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3
           Keywords|                            |ice-on-valid-code,
                   |                            |needs-bisection
      Known to fail|                            |12.2.0
            Summary|ICE in in                   |[12 Regression] ICE in in
                   |cxx_eval_component_referenc |cxx_eval_component_referenc
                   |e, at cp/constexpr.cc:4136  |e, at cp/constexpr.cc:4136
      Known to work|                            |11.3.0
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-01-06

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced further:
```
struct _Enable_copy_move {};
struct h {
  union {
    int _M_value;
  };
};
struct m {
  constexpr m(...) : _M_payload() {}
  constexpr m(const m &) {}
  h _M_payload;
};
struct optional : m, _Enable_copy_move {
  constexpr optional() {}
  template <typename _Up> constexpr optional(_Up __t) : m(__t) {}
};
struct array { optional t[1]; };

optional page {
  array {}
};

```

>clang++-15 doesn't (not sure if it's related, but i thought it's worth 
>mentioning:

That is a conditionally supported construct in C++. clang does not support it
but GCC does. 

GCC does warn with -Wconditionally-supported :

<source>: In instantiation of 'constexpr optional::optional(_Up) [with _Up =
array]':
<source>:20:1:   required from here
<source>:14:62: warning: passing objects of non-trivially-copyable type 'struct
array' through '...' is conditionally supported [-Wconditionally-supported]
   14 |   template <typename _Up> constexpr optional(_Up __t) : m(__t) {}
      |                                                              ^


Anyways this is fixed on the trunk; though since it is a GCC 12.x regression it
will/should be fixed on the GCC 12 branch too once someone figures out which
patch fixed it.

Reply via email to