8sa1-gcc/gcc/testsuite/g++.old-deja/g++.mike/p2846.C
Jason Merrill 4495766362 fix implicit int
From-SVN: r23760
1998-11-22 18:23:45 -05:00

56 lines
667 B
C

// prms-id: 2846
extern "C" int printf(const char *, ...);
extern "C" void exit(int);
class A;
class B;
class A {
public:
A(void){}
A(const A&){}
A(const B&);
virtual ~A(void){}
virtual void print(void) const {
printf("A::print\n");
printf("FAIL\n");
exit(1);
}
B compute(void) const;
};
class B : private A {
friend class A;
public:
virtual ~B(void){}
void print(void) const {
printf("B::print\n");
}
private:
B(const A& x, int){}
};
A::A(const B& s) {
s.print();
}
B A::compute(void) const {
B sub(*this, 1);
return sub;
}
int main ()
{
A titi;
A toto = titi.compute();
printf("PASS\n");
return 0;
}