https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124398
Bug ID: 124398
Summary: meta::constant_of invalid cases
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
>From https://eel.is/c++draft/meta.reflection#queries-example-2:
consteval info fn() {
constexpr int x = 42;
return ^^x;
}
constexpr info r = constant_of(fn()); // error: x is outside its
lifetime
But GCC accepts it. Please let me know if I've missed anything.
https://godbolt.org/z/Yf57YPxdx