view gcc/testsuite/g++.dg/overload/reftemp2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// DR 391 says that we always bind a reference to the base subobject; it is
// incorrect to call the A copy constructor to initialize the parameter of
// f.

int fail;

struct A {
  A() { }
  A(const A&) { fail = 1; }
};
struct B : public A { };
struct X {
  operator B() { return B(); }
};
X x;

void f (const A&) { }

int main()
{
  f(x);
  return fail;
}