gcc/testsuite/g++.dg/parse/typename6.C
raw| 1 | // { dg-do compile } |
| 2 | // Contributed by Matt Austern <austern at apple dot com> |
| 3 | // PR c++/13407: Gracefully handle keyword typename in base class specifier. |
| 4 | |
| 5 | struct A { }; |
| 6 | struct B { typedef A Type; }; |
| 7 | |
| 8 | template <typename T> |
| 9 | struct X : |
| 10 | public typename T::Type // { dg-error "not allowed in this context" } |
| 11 | { }; |
| 12 | |
| 13 | X<B> x; |
| 14 | |
| 15 | struct C : |
| 16 | public typename A // { dg-error "not allowed outside of templates" } |
| 17 | { }; |