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 // Tests that dependent expressions are always allowed, whereas non-dependent
6 // are checked as usual.
10 // Fake typeid, lacking a typeinfo header.
11 namespace std
{ class type_info
{}; }
13 struct dummy
{}; // expected-note 3 {{candidate constructor (the implicit copy constructor)}}
14 #if __cplusplus >= 201103L // C++11 or later
15 // expected-note@-2 3 {{candidate constructor (the implicit move constructor) not viable}}
20 return (sizeof(x
) == sizeof(int))? 0 : (sizeof(x
) == sizeof(double))? 1 : 2;
23 template <typename T
, typename U
>
24 T
f1(T t1
, U u1
, int i1
, T
** tpp
)
39 static_cast<void>(static_cast<U
>(reinterpret_cast<T
>(
40 dynamic_cast<U
>(const_cast<T
>(i1
)))));
47 dummy d1
= sizeof(t1
); // expected-error {{no viable conversion}}
48 dummy d2
= offsetof(T
, foo
); // expected-error {{no viable conversion}}
49 dummy d3
= __alignof(u1
); // expected-error {{no viable conversion}}
50 i1
= typeid(t1
); // expected-error {{assigning to 'int' from incompatible type 'const std::type_info'}}
51 i1
= tpp
[0].size(); // expected-error {{'T *' is not a structure or union}}
57 void f2(__restrict T x
) {} // expected-note {{substitution failure [with T = int]: restrict requires a pointer or reference ('int' is invalid}}
61 f2
<int>(0); // expected-error {{no matching function for call to 'f2'}}