1// The conversion from D* to B* is ambiguous, but that should not produce 2// an error, it should remove the first f overload by SFINAE. 3 4#define static_assert(TEST,STR) \ 5 do { int ar[(TEST)?1:-1]; } while (0); 6 7struct B {}; 8 9struct B1 : B {}; 10struct B2 : B {}; 11 12struct D : B1, B2 {}; 13 14template <class T> T create(); 15 16typedef char one[1]; 17typedef char two[2]; 18 19template <class T> 20 one &f(char (*)[sizeof static_cast<T>(create<D *>())]); 21template <class T> 22 two &f(...); 23 24int main() 25{ 26 static_assert(sizeof f<int>(0) == sizeof(two), ""); 27 static_assert(sizeof f<B *>(0) == sizeof(two), ""); 28} 29