gcc/testsuite/g++.dg/cpp0x/rv-func.C
raw| 1 | // PR c++/48457, Core 1238 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<class T> |
| 5 | T&& create(); |
| 6 | |
| 7 | template<class T, class Arg> |
| 8 | void test() { |
| 9 | T t(create<Arg>()); |
| 10 | (void) t; |
| 11 | } |
| 12 | |
| 13 | void f (void (&)()); |
| 14 | void f (void (&&)()); |
| 15 | |
| 16 | int main() { |
| 17 | test<void(&)(), void()>(); |
| 18 | test<void(&&)(), void()>(); |
| 19 | // This call should choose the lvalue reference overload. |
| 20 | // { dg-final { scan-assembler-not "_Z1fOFvvE" } } |
| 21 | f(create<void()>()); |
| 22 | } |