https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127389
Bug ID: 127389
Summary: GCC still rejects using the address of a non-first
array element as constant template argument
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
The following example uses the address of a non-first array element subobject
as constant template argument. It should be accepted since C++20 (due to
P1907R1).
```
template<auto V>
struct ConstantWrapper {
static constexpr auto value = V;
};
constexpr char a[]{"quick brown fox"};
constexpr auto ap1 = ConstantWrapper<a + 1>{};
static_assert(ap1.value - a == 1);
```
Currently (https://godbolt.org/z/P84zeEhbh), MSVC, Clang, and EDG accept it,
while GCC still rejects it.