diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.bob/protected1.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.bob/protected1.C | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.bob/protected1.C b/gcc/testsuite/g++.old-deja/g++.bob/protected1.C new file mode 100644 index 00000000000..e83f3e40b73 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.bob/protected1.C @@ -0,0 +1,41 @@ +// Build don't link: +class A { +public: + int i; + A(int j) : i(j){} +}; + +class B : protected A { +public: + B(int j) : A(j){} + void f(){ + A k(*this); + } +}; + +class C : protected B { +public: + C(int j) : B(j){} + void f(); + + void g(){ + A k(i); + } +}; + + +class D : public C { +public: + D(int w) : C(i) {} + void j() { A k(*this); } + void h() { i=3; } +}; + +void C::f() { + A k(*this); +} + +B b(3); +main() { + A *z = &b; // ERROR - +} |