summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/ref-bind2.C
blob: 967c59e06fd685a6d46167a0f3f1b05379ae8d8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
// { dg-do compile { target c++11 } }

// "const int *" and "int *" are reference-related, and 5.4.4.
// says that in that case, if the reference is an rvalue reference,
// the initializer expression shall not be an lvalue.

int &f (const int *&&);

void
fn (int *p)
{
  const int *&&r = p; // { dg-error "cannot bind rvalue reference" }
  f (p); // { dg-error "cannot bind rvalue reference" }
}