1 // RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx17 %std_cxx11-14 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17 %std_cxx17- %s
5 template<class T
> struct a
{ // precxx17-note {{here}}
7 return typename
T::x();
18 // Some extra tests for invalid cases
19 template<class T
> struct test2
{ T
b() { return typename
T::a
; } }; // expected-error{{expected '(' for function-style cast or type construction}}
20 template<class T
> struct test3
{ T
b() { return typename a
; } }; // expected-error{{expected a qualified name after 'typename'}} cxx17-error{{expected '(' for function-style cast or type construction}}
21 template<class T
> struct test4
{ T
b() { return typename ::a
; } }; // precxx17-error{{refers to non-type member}} expected-error{{expected '(' for function-style cast or type construction}}
24 namespace PR12884_original
{
25 template <typename T
> struct A
{
27 template <typename U
> struct X
{};
31 typedef B::X
<typename
B::arg
> x
; // precxx17-warning{{missing 'typename' prior to dependent type name B::X; implicit 'typename' is a C++20 extension}}
35 template <> struct A
<int>::B
{
36 template <int N
> struct X
{};
37 static const int arg
= 0;
42 namespace PR12884_half_fixed
{
43 template <typename T
> struct A
{
45 template <typename U
> struct X
{};
49 typedef typename
B::X
<typename
B::arg
> x
; // expected-error {{use 'template'}} expected-error {{refers to non-type}}
53 template <> struct A
<int>::B
{
54 template <int N
> struct X
{};
55 static const int arg
= 0; // expected-note {{here}}
58 A
<int>::C::x a
; // expected-note {{here}}
60 namespace PR12884_fixed
{
61 template <typename T
> struct A
{
63 template <typename U
> struct X
{};
67 typedef typename
B::template X
<B::arg
> x
;
71 template <> struct A
<int>::B
{
72 template <int N
> struct X
{};
73 static const int arg
= 0;