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
6 template <class T
> struct X
{};
8 template <> struct X
<char>
13 template <class T
> struct X2
{};
22 void a(char *a
, char *b
) {X2
<char*>::f();}
24 namespace WonkyAccess
{
34 struct Y
<U
*> : X
<U
> { };
37 struct Y
<float*> : X
<float> { };
39 int f(Y
<int*> y
, Y
<float*> y2
) {
44 // <rdar://problem/9169404>
45 namespace rdar9169404
{
46 template<typename T
, T N
> struct X
{ };
47 template<bool C
> struct X
<bool, C
> {
51 X
<bool, -1>::type value
;
52 #if __cplusplus >= 201103L
53 // expected-error@-2 {{non-type template argument evaluates to -1, which cannot be narrowed to type 'bool'}}
55 // expected-no-diagnostics
59 // rdar://problem/39524996
60 namespace rdar39524996
{
61 template <typename T
, typename U
>
62 struct enable_if_not_same
67 struct enable_if_not_same
<T
, T
>;
71 // Assertion triggered on trying to set twice the same partial specialization
72 // enable_if_not_same<int, int>
74 Wrapper(const Wrapper
<U
>& other
,
75 typename enable_if_not_same
<U
, T
>::type
* = 0) {}
77 explicit Wrapper(int i
) {}
82 // It is important that the struct has implicit copy and move constructors.
86 Container(const Container
<U
>& other
) : x(static_cast<T
>(other
.x
)) {}
88 // Implicit constructors are member-wise, so the field triggers instantiation
89 // of T constructors and we instantiate all of them for overloading purposes.
93 void takesWrapperInContainer(const Container
< Wrapper
<int> >& c
);
95 // Type mismatch triggers initialization with conversion which requires
96 // implicit constructors to be instantiated.
98 takesWrapperInContainer(c
);