| 1 |
// PR c++/112765 |
| 2 |
// { dg-additional-options "-Wparentheses" } |
| 3 |
|
| 4 |
struct A { |
| 5 |
A& operator=(const A&); |
| 6 |
operator bool() const; |
| 7 |
}; |
| 8 |
|
| 9 |
template<class T> |
| 10 |
void f(A a1, A a2) { |
| 11 |
if ((a2 = a1)) // { dg-bogus "parentheses" } |
| 12 |
return; |
| 13 |
bool b = (a2 = a1); // { dg-bogus "parentheses" } |
| 14 |
} |
| 15 |
|
| 16 |
template void f<int>(A, A); |
| 17 |
|
| 18 |
template<class T> |
| 19 |
void g(T a1, T a2) { |
| 20 |
if ((a2 = a1)) // { dg-bogus "parentheses" } |
| 21 |
return; |
| 22 |
bool b = (a2 = a1); // { dg-bogus "parentheses" } |
| 23 |
} |
| 24 |
|
| 25 |
template void g<A>(A, A); |