Created on 2021-06-15.00:00:00 last changed 36 months ago
Notes from the November, 2021 teleconference:
A similar example can be constructed involving overload resolution instead of partial specialization:
template<typename T, typename U> struct S {};
template<typename T> struct S<T, T> {};
template<typename T, typename U> struct S<T*, U*> {};
template<class T>
bool f(T, typename S<T, T>::type = 0);
bool f(...);
int x;
bool b = f(&x); // hard error with gcc, ok with clang
Consider the following example:
template<typename T, typename U> struct S {}; template<typename T> struct S<T, T> {}; template<typename T, typename U> struct S<T*, U*> {}; template<typename... Ts> using V = void; template<typename T, typename U = void> struct X {}; template<typename T> struct X<T, V<typename S<T, T>::type>>; X<int*> xpi;
Determining whether the partial specialization of X matches X<int*> requires determining whether one of the partial specializations of S matches S<int*,int*>. The partial specializations of S are ambiguous for this case. The question is whether that ambiguity should be considered in the “immediate context” of the type (SFINAE) or whether it should result in a hard error. There is implementation divergence on the handling of this example.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-11-15 00:00:00 | admin | set | messages: + msg6560 |
2021-06-15 00:00:00 | admin | create |