gcc/testsuite/g++.dg/overload/conv-op4.C
raw| 1 | // PR c++/81952 |
| 2 | // { dg-do run { target c++11 } } |
| 3 | |
| 4 | template <class T> |
| 5 | struct opt { |
| 6 | opt() { } |
| 7 | opt(opt const& ) { __builtin_abort (); } |
| 8 | opt(opt&& ) { __builtin_abort (); } |
| 9 | |
| 10 | template <class U> |
| 11 | opt(U&& ) { } |
| 12 | }; |
| 13 | |
| 14 | struct foo |
| 15 | { |
| 16 | explicit operator opt<int>() { __builtin_abort (); return {}; } |
| 17 | }; |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | opt<int> o(foo{}); |
| 22 | } |