gcc/testsuite/g++.dg/lookup/scoped1.C
raw| 1 | // Test that explicitly scoped references to static members work even if |
| 2 | // they belong to an inaccessible base. |
| 3 | |
| 4 | struct A |
| 5 | { |
| 6 | static int i1; |
| 7 | int i2; |
| 8 | static void f1 (); |
| 9 | void f2 (); |
| 10 | }; |
| 11 | |
| 12 | struct B: private A { }; // { dg-message "declared" } |
| 13 | struct C: public B |
| 14 | { |
| 15 | void g () |
| 16 | { |
| 17 | ::A::i1 = 1; |
| 18 | ::A::i2 = 1; // { dg-error "(access)|(context)" } |
| 19 | ::A::f1 (); |
| 20 | ::A::f2 (); // { dg-error "" } |
| 21 | } |
| 22 | }; |