nested-name-spec-locations.cpp
4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// RUN: %clang_cc1 -fsyntax-only -verify %s
// Note: the formatting in this test case is intentionally funny, with
// nested-name-specifiers stretched out vertically so that we can
// match up diagnostics per-line and still verify that we're getting
// good source-location information.
namespace outer {
namespace inner {
template<typename T>
struct X0 {
};
}
}
template<typename T>
struct add_reference {
typedef T& type;
};
namespace outer_alias = outer;
template<typename T>
struct UnresolvedUsingValueDeclTester {
using outer::inner::X0<
typename add_reference<T>::type
* // expected-error{{declared as a pointer to a reference of type}}
>::value;
};
UnresolvedUsingValueDeclTester<int> UnresolvedUsingValueDeclCheck; // expected-note{{in instantiation of template class}}
template<typename T>
struct UnresolvedUsingTypenameDeclTester {
using outer::inner::X0<
typename add_reference<T>::type
* // expected-error{{declared as a pointer to a reference of type}}
>::value;
};
UnresolvedUsingTypenameDeclTester<int> UnresolvedUsingTypenameDeclCheck; // expected-note{{in instantiation of template class}}
template<typename T, typename U>
struct PseudoDestructorExprTester {
void f(T *t) {
t->T::template Inner<typename add_reference<U>::type
* // expected-error{{as a pointer to a reference of type}}
>::Blarg::~Blarg();
}
};
struct HasInnerTemplate {
template<typename T>
struct Inner;
typedef HasInnerTemplate T;
};
void PseudoDestructorExprCheck(
PseudoDestructorExprTester<HasInnerTemplate, float> tester) {
tester.f(0); // expected-note{{in instantiation of member function}}
}
template<typename T>
struct DependentScopedDeclRefExpr {
void f() {
outer_alias::inner::X0<typename add_reference<T>::type
* // expected-error{{as a pointer to a reference of type}}
>::value = 17;
}
};
void DependentScopedDeclRefExprCheck(DependentScopedDeclRefExpr<int> t) {
t.f(); // expected-note{{in instantiation of member function}}
}
template<typename T>
struct TypenameTypeTester {
typedef typename outer::inner::X0<
typename add_reference<T>::type
* // expected-error{{declared as a pointer to a reference of type}}
>::type type;
};
TypenameTypeTester<int> TypenameTypeCheck; // expected-note{{in instantiation of template class}}
template<typename T, typename U>
struct DependentTemplateSpecializationTypeTester {
typedef typename T::template apply<typename add_reference<U>::type
* // expected-error{{declared as a pointer to a reference of type}}
>::type type;
};
struct HasApply {
template<typename T>
struct apply {
typedef T type;
};
};
DependentTemplateSpecializationTypeTester<HasApply, int> DTSTCheck; // expected-note{{in instantiation of template class}}
template<typename T, typename U>
struct DependentTemplateSpecializationTypeTester2 {
typedef typename T::template apply<typename add_reference<U>::type
* // expected-error{{declared as a pointer to a reference of type}}
> type;
};
DependentTemplateSpecializationTypeTester2<HasApply, int> DTSTCheck2; // expected-note{{in instantiation of template class}}
template<typename T, typename U>
struct DependentTemplateSpecializationTypeTester3 :
T::template apply<typename add_reference<U>::type
* // expected-error{{declared as a pointer to a reference of type}}
>
{};
DependentTemplateSpecializationTypeTester3<HasApply, int> DTSTCheck3; // expected-note{{in instantiation of template class}}
template<typename T, typename U>
struct DependentTemplateSpecializationTypeTester4 {
typedef class T::template apply<typename add_reference<U>::type
* // expected-error{{declared as a pointer to a reference of type}}
> type;
};
DependentTemplateSpecializationTypeTester4<HasApply, int> DTSTCheck4; // expected-note{{in instantiation of template class}}
template<template<class T> class TTP>
struct AcceptedTemplateTemplateParameter {
};
template<typename T, typename U>
struct DependentTemplateTemplateArgumentTester {
typedef AcceptedTemplateTemplateParameter<
T::
template apply<
typename add_reference<U>::type
* // expected-error{{declared as a pointer to a reference of type}}
>::
template X>
type;
};
DependentTemplateTemplateArgumentTester<HasApply, int> DTTACheck; // expected-note{{in instantiation of template class}}
namespace PR9388 {
namespace std {
template<typename T> class vector {
};
}
template<typename T> static void foo(std::vector<T*> &V) {
__PRETTY_FUNCTION__; // expected-warning{{expression result unused}}
}
void bar(std::vector<int*> &Blocks) {
foo(Blocks); // expected-note{{in instantiation of}}
}
}