gcc/testsuite/g++.dg/template/access31.C
raw| 1 | // PR c++/47346 |
| 2 | // { dg-do compile } |
| 3 | |
| 4 | class C |
| 5 | { |
| 6 | struct Private { }; |
| 7 | }; |
| 8 | |
| 9 | template<typename T> |
| 10 | struct exploit1 |
| 11 | { |
| 12 | typedef C::Private type; // { dg-error "private" } |
| 13 | }; |
| 14 | exploit1<int>::type x1; |
| 15 | |
| 16 | template<typename T> |
| 17 | struct exploit2 : C::Private // { dg-error "private" } |
| 18 | { |
| 19 | }; |
| 20 | exploit2<int> x2; |
| 21 | |
| 22 | template<typename T> |
| 23 | struct exploit3 |
| 24 | { |
| 25 | template<class U = C::Private> // { dg-error "private" } |
| 26 | struct E {}; |
| 27 | }; |
| 28 | |
| 29 | exploit3<int>::E<> e; |