summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/overload/reftemp2.C
blob: 365d5b13f5065a97a944343aae0e3cf9ee2007dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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;
}