| 1 |
// PR c++/58170 |
| 2 |
// { dg-require-effective-target c++11 } |
| 3 |
// { dg-prune-output "not declared" } |
| 4 |
// { dg-prune-output "expected" } |
| 5 |
|
| 6 |
template <typename T, typename U> |
| 7 |
struct base { |
| 8 |
template <typename V> |
| 9 |
struct derived; |
| 10 |
}; |
| 11 |
|
| 12 |
template <typename T, typename U> |
| 13 |
template <typename V> |
| 14 |
struct base<T, U>::derived : public base<T, V> { |
| 15 |
}; |
| 16 |
|
| 17 |
// This (wrong?) alias declaration provokes the crash. |
| 18 |
template <typename T, typename U, typename V> |
| 19 |
using alias = base<T, U>::derived<V>; // { dg-error "template|typename" } |
| 20 |
|
| 21 |
// This one works: |
| 22 |
// template <typename T, typename U, typename V> |
| 23 |
// using alias = typename base<T, U>::template derived<V>; |
| 24 |
|
| 25 |
template <typename T> |
| 26 |
void f() { |
| 27 |
alias<T, bool, char> m{}; |
| 28 |
(void) m; |
| 29 |
} |
| 30 |
|
| 31 |
int main() { |
| 32 |
f<int>(); |
| 33 |
} |