gcc/testsuite/g++.dg/warn/effc5.C
raw| 1 | // PR c++/98841 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-Weffc++" } |
| 4 | |
| 5 | struct S { |
| 6 | template <typename T> |
| 7 | S& operator=(const T&) { return *this; } // { dg-bogus "should return a reference to" } |
| 8 | S& operator=(const S&) { return *this; } |
| 9 | }; |
| 10 | |
| 11 | void |
| 12 | foo () |
| 13 | { |
| 14 | S s, t; |
| 15 | s = 1; |
| 16 | s = t; |
| 17 | } |