https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119339
Bug ID: 119339
Summary: Allows invalid constexpr of addresses with references
initialized to itself
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Blocks: 55004
Target Milestone: ---
Take:
```
constexpr int f() { int &a = a; return &a+1-&a; }
constexpr int z = f();
```
This should be rejected. as &a does not really point anywhere.
Forwarded from https://github.com/llvm/llvm-project/issues/131654 .
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues