aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/arm7.C
blob: 1f3d43056ad60e768191110cb66f18454c3cc509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Special g++ Options: -w
// GROUPS passed ARM-compliance
// arm file (also in cvt file)
// Message-Id: <9303061246.AA09402@gjetost.cs.wisc.edu>
// From: solomon@cs.wisc.edu (Marvin Solomon)
// Subject: Incorrect resolution of conversion path
// Date: Sat, 6 Mar 93 06:46:27 -0600


extern "C" void printf(const char *,...);

class Base {
public:
	int i;
	Base(int ii) : i(ii) {}
};

class Derived : public Base {
public:
	Derived(int ii) : Base(ii) {}
	operator Base&();
};

Derived::operator Base&() {
	Base *b = new Base(100*i);
	return *b;
}

void f(Base &b) {
	if (b.i == 99)
	  printf ("PASS\n");
	else
	  printf ("FAIL\n");
}

int main() {
	Derived d(99);
	f(d);
	return 0;
}