gcc/testsuite/g++.old-deja/g++.bob/inherit1.C
raw| 1 | // { dg-do assemble } |
| 2 | class A { |
| 3 | char str[10]; |
| 4 | public: |
| 5 | char* m1 () { return str;} |
| 6 | }; |
| 7 | |
| 8 | class C : public A { |
| 9 | public: |
| 10 | }; |
| 11 | |
| 12 | class B : public A { |
| 13 | public: |
| 14 | char* m1 () { C::m1(); return ""; } // { dg-error "cannot call" } |
| 15 | // { dg-warning "deprecated|forbids converting a string constant" "depr" { target *-*-* } .-1 } |
| 16 | }; |
| 17 | |
| 18 | int main () { |
| 19 | A a; |
| 20 | B b; |
| 21 | C c; |
| 22 | |
| 23 | a.m1(); |
| 24 | c.m1(); |
| 25 | b.m1(); |
| 26 | } |