view gcc/testsuite/g++.dg/cpp0x/ref-bind2.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// 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" }
}