You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When forming the normalized constraints, it is unclear how the type of X1 in the definition of C2 affects the parameter mapping. https://wg21.link/temp.constr.normal#1.4 does not seem to address this at all.
There is implementation divergence:
GCC and MSVC reject the call to f from g (resolving to #2) and similarly resolves the call to f from h to #2.
Clang and EDG accept the call to f from g (resolving to #1) and rejects the call to f from h as ambiguous.
Adopting the GCC/MSVC behaviour, which seems to ignore the type of X1 in the definition of C2, seems objectively wrong: 65536u is not a value that C2 accepts.
The Clang and EDG behaviour suggests that the parameter mapping for the B<X0> atomic constraints are different between #1 and #2. Presumably when substituting X from #2 into the normalized constraint for C2, some decoration was included.
Suggested resolution
Introducing some sort of "shadow constraint" that X is a valid template argument for a template parameter declared as unsigned short when normalizing the use of C2 from #2 would reject the call from g but accept the call from h as resolving to #2. This seems to be a sensible result, but leaves none of the surveyed implementations unscathed.
The text was updated successfully, but these errors were encountered:
jensmaurer
changed the title
[temp.constr.normal] Effect of concept _template-head_s on parameter mappings
CWG2975 [temp.constr.normal] Effect of concept _template-head_s on parameter mappings
Dec 27, 2024
Full name of submitter (unless configured in github; will be published with the issue): Hubert Tong
Reference (section label): temp.constr.normal
Link to reflector thread (if any): N/A
Issue description
Consider:
When forming the normalized constraints, it is unclear how the type of
X1
in the definition ofC2
affects the parameter mapping. https://wg21.link/temp.constr.normal#1.4 does not seem to address this at all.There is implementation divergence:
GCC and MSVC reject the call to
f
fromg
(resolving to#2
) and similarly resolves the call tof
fromh
to#2
.Clang and EDG accept the call to
f
fromg
(resolving to#1
) and rejects the call tof
fromh
as ambiguous.Online compiler link: https://godbolt.org/z/hEKaosbWe
Adopting the GCC/MSVC behaviour, which seems to ignore the type of
X1
in the definition ofC2
, seems objectively wrong:65536u
is not a value thatC2
accepts.The Clang and EDG behaviour suggests that the parameter mapping for the
B<X0>
atomic constraints are different between#1
and#2
. Presumably when substitutingX
from#2
into the normalized constraint forC2
, some decoration was included.Suggested resolution
Introducing some sort of "shadow constraint" that
X
is a valid template argument for a template parameter declared asunsigned short
when normalizing the use ofC2
from#2
would reject the call fromg
but accept the call fromh
as resolving to#2
. This seems to be a sensible result, but leaves none of the surveyed implementations unscathed.The text was updated successfully, but these errors were encountered: