| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// Copyright (C) 2005 Free Software Foundation, Inc. |
| 3 |
// Contributed by Nathan Sidwell 16 Sep 2005 <[email protected]> |
| 4 |
|
| 5 |
// PR 23519 template specialization ordering (DR214) |
| 6 |
// Origin: Maxim Yegorushkin <[email protected]> |
| 7 |
|
| 8 |
// DR532 clarified that the * expression is ambiguous. |
| 9 |
|
| 10 |
struct A |
| 11 |
{ |
| 12 |
template<class T> int operator+(T&) = delete; |
| 13 |
}; |
| 14 |
|
| 15 |
template<class T> struct B |
| 16 |
{ |
| 17 |
int operator-(A&) {return 2;} |
| 18 |
template<typename R> int operator*(R&) {return 3;} |
| 19 |
}; |
| 20 |
|
| 21 |
template <typename T, typename R> int operator-(B<T>, R&) = delete; |
| 22 |
template<class T> int operator+(A&, B<T>&) { return 5;} |
| 23 |
template <typename T> int operator*(T &, A&){return 6;} |
| 24 |
|
| 25 |
int main() |
| 26 |
{ |
| 27 |
A a; |
| 28 |
B<A> b; |
| 29 |
if ((a + b) != 5) |
| 30 |
return 1; |
| 31 |
|
| 32 |
if ((b - a) != 2) |
| 33 |
return 2; |
| 34 |
|
| 35 |
if ((b * a) != 6) // { dg-error "ambiguous" } |
| 36 |
return 3; |
| 37 |
} |