[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / clang / test / SemaTemplate / typename-specifier-3.cpp
blobdc9d00601d48659c145312f570eb2c4c55b765f0
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // PR4364
4 template<class T> struct a { // expected-note {{here}}
5 T b() {
6 return typename T::x();
8 };
9 struct B {
10 typedef B x;
12 B c() {
13 a<B> x;
14 return x.b();
17 // Some extra tests for invalid cases
18 template<class T> struct test2 { T b() { return typename T::a; } }; // expected-error{{expected '(' for function-style cast or type construction}}
19 template<class T> struct test3 { T b() { return typename a; } }; // expected-error{{expected a qualified name after 'typename'}}
20 template<class T> struct test4 { T b() { return typename ::a; } }; // expected-error{{refers to non-type member}} expected-error{{expected '(' for function-style cast or type construction}}
22 // PR12884
23 namespace PR12884_original {
24 template <typename T> struct A {
25 struct B {
26 template <typename U> struct X {};
27 typedef int arg;
29 struct C {
30 typedef B::X<typename B::arg> x; // expected-error {{missing 'typename'}}
34 template <> struct A<int>::B {
35 template <int N> struct X {};
36 static const int arg = 0;
39 A<int>::C::x a;
41 namespace PR12884_half_fixed {
42 template <typename T> struct A {
43 struct B {
44 template <typename U> struct X {};
45 typedef int arg;
47 struct C {
48 typedef typename B::X<typename B::arg> x; // expected-error {{use 'template'}} expected-error {{refers to non-type}}
52 template <> struct A<int>::B {
53 template <int N> struct X {};
54 static const int arg = 0; // expected-note {{here}}
57 A<int>::C::x a; // expected-note {{here}}
59 namespace PR12884_fixed {
60 template <typename T> struct A {
61 struct B {
62 template <typename U> struct X {};
63 typedef int arg;
65 struct C {
66 typedef typename B::template X<B::arg> x;
70 template <> struct A<int>::B {
71 template <int N> struct X {};
72 static const int arg = 0;
75 A<int>::C::x a; // ok