gcc/testsuite/g++.dg/other/pr94326.C
raw| 1 | // PR c++/94326 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | // { dg-options "-fcompare-debug" } |
| 4 | |
| 5 | template <typename = int> struct A { |
| 6 | const int &foo() { return 0; } // { dg-message "returning reference to temporary" } |
| 7 | template <typename _Kt> void bar(_Kt) { foo(); } |
| 8 | }; |
| 9 | struct B { |
| 10 | A<> b; |
| 11 | template <typename _Kt> auto baz(_Kt p1) -> decltype(b.bar(p1)) { |
| 12 | b.bar(p1); |
| 13 | } |
| 14 | }; |
| 15 | struct C {}; |
| 16 | void operator<(C, int) { |
| 17 | B a; |
| 18 | a.baz(C{}); |
| 19 | } |