https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127537
--- Comment #1 from Ivan Lazaric <ivan.lazaric.gcc at gmail dot com> ---
Turns out this can be minimized quite a bit further
```cpp
struct Y;
template<class T>
constexpr void g() { T().f(); }
struct V {
void (*f)();
constexpr V(auto) : f(g<Y>) {}
};
constexpr void f(int a) { V{a}; }
struct Y { consteval void f(); };
consteval { V{1}; }
```
Don't need the `.ii` shenanigans, treat as regular C++ source
Flags: "-std=c++26 -fsyntax-only"
Helper script to run this a bunch of times:
```bash
#!/usr/bin/env bash
set -euo pipefail
seq 1 100 | parallel -j 10 'g++ prog.cpp -std=c++26 -fsyntax-only -o prog{} &>
/dev/null && echo success || echo failure' | sort | uniq -c
```
A couple of example runs:
```
ilazaric@ilazaric-gram:~/repos/repro2$ ./runner.sh
72 failure
28 success
ilazaric@ilazaric-gram:~/repos/repro2$ ./runner.sh
62 failure
38 success
ilazaric@ilazaric-gram:~/repos/repro2$ ./runner.sh
64 failure
36 success
ilazaric@ilazaric-gram:~/repos/repro2$ ./runner.sh
65 failure
35 success
```
Example of exit code 0 output:
```
ilazaric@ilazaric-gram:~/repos/repro2$ g++ -std=c++26 prog.cpp -fsyntax-only
prog.cpp:13:27: warning: inline function 'consteval void Y::f()' used but never
defined
13 | struct Y { consteval void f(); };
| ^
```
Example of exit code 1 output:
```
ilazaric@ilazaric-gram:~/repos/repro2$ g++ -std=c++26 prog.cpp -fsyntax-only
prog.cpp:13:27: warning: inline function 'consteval void Y::f()' used but never
defined
13 | struct Y { consteval void f(); };
| ^
prog.cpp: In function 'constexpr void f(int)':
prog.cpp:11:30: error: call to consteval function 'V(a)' is not a constant
expression
11 | constexpr void f(int a) { V{a}; }
| ^
prog.cpp:11:30: error: 'a' is not a constant expression
prog.cpp:11:30: note: 'constexpr V::V(auto:1) [with auto:1 = int]' was promoted
to an immediate function
PROGRAM FAILED WITH EXIT CODE 1
```
It also turns out to not have anything to do with reflection.