gcc/testsuite/g++.dg/cpp0x/ref-bind2.C
raw| 1 | // PR c++/91844 - Implement CWG 2352, Similar types and reference binding. |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | // "const int *" and "int *" are reference-related, and 5.4.4. |
| 5 | // says that in that case, if the reference is an rvalue reference, |
| 6 | // the initializer expression shall not be an lvalue. |
| 7 | |
| 8 | int &f (const int *&&); |
| 9 | |
| 10 | void |
| 11 | fn (int *p) |
| 12 | { |
| 13 | const int *&&r = p; // { dg-error "cannot bind rvalue reference" } |
| 14 | f (p); // { dg-error "cannot bind rvalue reference" } |
| 15 | } |