1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
5 // C++98 [basic.lookup.classref]p1:
6 // In a class member access expression (5.2.5), if the . or -> token is
7 // immediately followed by an identifier followed by a <, the identifier must
8 // be looked up to determine whether the < is the beginning of a template
9 // argument list (14.2) or a less-than operator. The identifier is first
10 // looked up in the class of the object expression. If the identifier is not
11 // found, it is then looked up in the context of the entire postfix-expression
12 // and shall name a class or function template. If the lookup in the class of
13 // the object expression finds a template, the name is also looked up in the
14 // context of the entire postfix-expression and
15 // -- if the name is not found, the name found in the class of the object
16 // expression is used, otherwise
17 // -- if the name is found in the context of the entire postfix-expression
18 // and does not name a class template, the name found in the class of the
19 // object expression is used, otherwise
20 // -- if the name found is a class template, it must refer to the same
21 // entity as the one found in the class of the object expression,
22 // otherwise the program is ill-formed.
27 #if __cplusplus <= 199711L
28 // expected-note@-2 {{lookup from the current scope refers here}}
33 #if __cplusplus <= 199711L
34 // expected-note@-2 {{lookup in the object type 'Value' refers here}}
37 void resolves_to_same() {
42 void resolves_to_different() {
45 // The fact that the next line is a warning rather than an error is an
48 #if __cplusplus <= 199711L
49 // expected-warning@-2 {{lookup of 'set' in member access expression is ambiguous; using member of 'Value'}}
53 int set
; // Non-template.
59 namespace rdar9915664
{
61 template<typename T
> void a();
69 A
&getA() { return static_cast<B
&>(*this); }
78 template<typename T
> T
end(T
);
83 if (it1
->end
< it1
->end
) {
87 template<typename T
> T
*end(T
*);
93 if (it1
->end
< it1
->end
) {
97 if (x
->end
< 7) { // expected-error{{no member named 'end' in 'PR11856::X'}}