gcc/testsuite/g++.old-deja/g++.other/lookup18.C
raw| 1 | // { dg-do assemble } |
| 2 | // Test that referring to an ambiguous base in name lookup prevents |
| 3 | // access to the field, even though the field is not ambiguous. |
| 4 | |
| 5 | |
| 6 | struct A { |
| 7 | int i; |
| 8 | }; |
| 9 | struct B: virtual A { }; |
| 10 | struct C: public B { }; |
| 11 | struct D: public B { }; |
| 12 | struct E: public C, public D { |
| 13 | void f (); |
| 14 | }; |
| 15 | |
| 16 | void E::f() { |
| 17 | B::i = 0; // { dg-error "" } B is ambiguous |
| 18 | } |
| 19 | |
| 20 | void f () { |
| 21 | E e; |
| 22 | e.B::i = 0; // { dg-error "" } B is ambiguous |
| 23 | } |