1 // RUN: %clang_cc1 -std=c++2a -verify %s
5 template<typename
> int f(Q
);
6 template<int> int f(Q
);
7 template<typename
> int g(Q
);
8 template<int> int g(Q
);
10 template<int> int some_long_name(Q
); // expected-note {{here}}
16 template<int> int h(...);
19 // OK, these find the above functions by ADL.
25 int e
= h
<0>(q
); // ok, found by unqualified lookup
30 f
<0>(q
); // expected-error {{invalid operands to binary expression}} // expected-warning {{comparisons like 'X<=Y<=Z' don't have their mathematical meaning}}
34 // FIXME: It's unclear whether ending the template argument at the > inside the ?: is correct here (see DR579).
35 f
<true ? 1 > 2 : 3>(q
); // expected-error {{expected ':'}} expected-note {{to match}} expected-error {{expected expression}}
37 f
< 1 + 3 > (q
); // ok, function call
40 bool typo(int something
) { // expected-note 4{{declared here}}
41 // FIXME: We shouldn't suggest the N:: for an ADL call if the candidate can be found by ADL.
42 some_logn_name
<3>(q
); // expected-error {{did you mean 'N::some_long_name'?}}
43 somethign
< 3 ? h() > 4 : h(0); // expected-error {{did you mean 'something'}}
44 // This is parsed as a comparison on the left of a ?: expression.
45 somethign
< 3 ? h() + 4 : h(0); // expected-error {{did you mean 'something'}}
46 // This is parsed as an ADL-only template-id call.
47 somethign
< 3 ? h() + 4 : h(0) >(0); // expected-error {{undeclared identifier 'somethign'}}
48 bool k(somethign
< 3); // expected-error {{did you mean 'something'}}
49 return somethign
< 3; // expected-error {{did you mean 'something'}}
52 // Ensure that treating undeclared identifiers as template names doesn't cause
54 struct W
<int> {}; // expected-error {{undeclared template struct 'W'}}
55 X
<int>::Y xy
; // expected-error {{no template named 'X'}}
56 void xf(X
<int> x
); // expected-error {{no template named 'X'}}
57 struct A
: X
<int> { // expected-error {{no template named 'X'}}
58 A() : X
<int>() {} // expected-error {{no template named 'X'}}
61 // Similarly for treating overload sets of functions as template names.
62 struct g
<int> {}; // expected-error {{'g' refers to a function template}}
63 g
<int>::Y xy
; // expected-error {{no template named 'g'}} FIXME lies
64 void xf(g
<int> x
); // expected-error {{variable has incomplete type 'void'}} expected-error 1+{{}} expected-note {{}}
65 struct B
: g
<int> { // expected-error {{expected class name}}
66 B() : g
<int>() {} // expected-error {{expected class member or base class name}}
69 namespace vector_components
{
70 typedef __attribute__((__ext_vector_type__(2))) float vector_float2
;
71 bool foo123(vector_float2
&A
, vector_float2
&B
)
73 return A
.x
< B
.x
&& B
.y
> A
.y
;