| 1 |
// PR c++/112744 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
struct A { constexpr static int a = 0; }; |
| 5 |
struct D : private A {}; |
| 6 |
|
| 7 |
// The injected-class-name of A is private when named in D, but if A is named |
| 8 |
// some other way, there is no requirement in [class.access.base] for static data |
| 9 |
// members that it be an accessible base. |
| 10 |
|
| 11 |
void f() { |
| 12 |
D{}.A::a; // { dg-error "inaccessible" } |
| 13 |
D{}.::A::a; |
| 14 |
} |
| 15 |
|
| 16 |
template<class T> |
| 17 |
void g() { |
| 18 |
D{}.T::a; |
| 19 |
} |
| 20 |
|
| 21 |
template void g<A>(); |