https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107079
Bug ID: 107079
Summary: ICE initializing lifetime-extended constexpr variable
that stores its this pointer
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: johelegp at gmail dot com
CC: johelegp at gmail dot com
Target Milestone: ---
See https://godbolt.org/z/5asqcnoMe.
```C++
struct X {
const X* x = this;
};
constexpr const X& x = X{};
```
```
<source>:4:26: internal compiler error: in cxx_eval_constant_expression, at
cp/constexpr.cc:7591
4 | constexpr const X& x = X{};
| ^
0x23507de internal_error(char const*, ...)
???:0
0xa9ea08 fancy_abort(char const*, int, char const*)
???:0
0xd4f2da store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
???:0
0xb78f38 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0xc786f7 c_parse_file()
???:0
0xdb4a19 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```