gcc/testsuite/g++.dg/template/sfinae28.C
raw| 1 | // Origin: PR c++/44267 |
| 2 | |
| 3 | struct B {}; |
| 4 | struct D : B {}; |
| 5 | struct VD : virtual B {}; |
| 6 | |
| 7 | template <class T> T create(); |
| 8 | |
| 9 | typedef char one[1]; |
| 10 | typedef char two[2]; |
| 11 | |
| 12 | template <class D, class B> |
| 13 | one& f(char (*)[sizeof(static_cast<D>(create<B>()))]); |
| 14 | |
| 15 | template <class D, class B> |
| 16 | two& f(...); |
| 17 | |
| 18 | int main() |
| 19 | { |
| 20 | f<D*, int>(0); |
| 21 | f<D*, B*>(0); |
| 22 | f<VD*, B*>(0); |
| 23 | return 0; |
| 24 | } |