Created on 2014-11-13.00:00:00 last changed 34 months ago
Suggested resolution:
Change the referenced bullet to read:
a subobject (6.7.2 [intro.object]) that is not the first element of a complete object of array type,
Note that this resolution also allows an example like
template<char &p> struct S { }; char arr[2]; S<arr[0]> s_arr;
which may not be exactly what we want.
See also issue 2401.
According to 13.4.3 [temp.arg.nontype] paragraph 1 (newly revised by the adoption of paper N4268),
For a non-type template-parameter of reference or pointer type, the value of the constant expression shall not refer to (or for a pointer type, shall not be the address of):
a subobject (6.7.2 [intro.object]),
...
This change breaks an example like
template<int *p> struct X {}; int arr[32]; X<arr> x;
because the array-to-pointer decay produces a pointer to the first element, which is a subobject.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-02-18 07:47:23 | admin | set | messages: + msg6708 |
2014-11-13 00:00:00 | admin | create |