| 1 |
// { dg-do compile } |
| 2 |
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> |
| 3 |
// DR176: Name injection and templates |
| 4 |
|
| 5 |
namespace N1 { |
| 6 |
template <class T> struct Base { |
| 7 |
Base* p; |
| 8 |
Base<T*>* p2; |
| 9 |
::Base* p3; // { dg-error "" } |
| 10 |
}; |
| 11 |
|
| 12 |
template <class T> struct Derived: public Base<T> { |
| 13 |
Base* p; // { dg-error "" "unqualified name binds to N1::Base" } |
| 14 |
Base<T*>* p2; |
| 15 |
typename Derived::Base* p3; // { dg-bogus "" "injected class name in derived classes" } |
| 16 |
}; |
| 17 |
|
| 18 |
template struct Derived<void>; // { dg-bogus "required from here" "everything should be looked up at parsing time (after DR224)" } |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
namespace N2 { |
| 23 |
template <class T> struct Base {}; |
| 24 |
template <class T> struct Derived: public Base<T> { |
| 25 |
typename Derived::template Base<double>* p1; // { dg-bogus "" } |
| 26 |
}; |
| 27 |
|
| 28 |
template struct Derived<void>; |
| 29 |
} |