https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127856
Bug ID: 127856
Summary: [GCC C++26 reflection] class with a `std::meta::info`
member and a default member initializer, instantiated
as a local at `-O1`+: ICE in
`type_contains_placeholder_1` (tree.cc:4463) during
`ealias`/`esra`
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: 0599jiangyc at gmail dot com
Target Milestone: ---
**Repo:** gcc-mirror/gcc · **Commit:** `d373724d1` (master, 2026-09-17) ·
**Build:** `--enable-languages=c,c++ --disable-bootstrap
--enable-checking=yes,extra,rtl` (x86_64-pc-linux-gnu, Ubuntu 22.04)
## What happens
The reflection type (`decltype(^^int)`, i.e. `std::meta::info`) has its own
tree code. As long as such objects stay in constant evaluation nothing in the
middle end sees the type, but a class with an `info` member *and* a non-trivial
default constructor (here from the `bool none = true;` member initializer) is
constructed at run time, and the aggregate store reaches points-to analysis
(`ealias`) or SRA (`esra`), which call `type_contains_placeholder_p` on the
member type. `type_contains_placeholder_1` has no case for the reflection type
code and ends in `gcc_unreachable ()`.
```
during GIMPLE pass: ealias
t.cc: In constructor 'constexpr arg::arg()':
t.cc:2:20: internal compiler error: in type_contains_placeholder_1, at
tree.cc:4463
2 | void f () { arg a; }
| ^
0x3046dcb internal_error(char const*, ...)
diagnostic-global-context.cc:787
0xdd9a1e fancy_abort(char const*, int, char const*)
diagnostics/context.cc:1813
0xa6207d type_contains_placeholder_1
tree.cc:4463
0xa6207d type_contains_placeholder_p(tree_node*)
tree.cc:4484
0x1c0deb5 type_contains_placeholder_1
tree.cc:4456
0x1c0deb5 type_contains_placeholder_p(tree_node*)
tree.cc:4484
0x1b01516 create_variable_info_for_1
gimple-ssa-pta-constraints.cc:3412
0x1b06863 intra_create_variable_infos
```
## Reproducer
`gcc-reflection-info-member-nontrivial-ctor-middle-end.cc`:
```cpp
struct arg { decltype(^^int) name; bool none = true; };
void f () { arg a; }
```
```bash
g++ -c -o /dev/null -O1 -std=c++26 -freflection
gcc-reflection-info-member-nontrivial-ctor-middle-end.cc
```
`-O0` and `-Og` compile (no `ealias`); `-O1`, `-O2` and `-Ofast` ICE. A
namespace-scope object (`arg g;`), a class without the default member
initializer, or a local of type `std::meta::info` alone all compile. A second
fused input reaches the same assert from `esra` with the member in a class held
in a `std::optional` and swapped at `-Ofast`.
## Expected
Compile: an `info` object is a scalar-sized trivially-copyable value at run
time, or, if run-time objects of reflection type are meant to be rejected, a
front-end diagnostic.
## Notes
Found twice: fusing `g++.dg/reflect/reflect_constant_array5.cc` with
`gcc.dg/misaligned-expand-1.c` (ealias, `-O2`) and `g++.dg/reflect/p2996-18.cc`
with a
`std::optional`/`swap` seed (esra, `-Ofast`). Searched Bugzilla for
`type_contains_placeholder_1`: no match.