// RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // PR4607 template struct X {}; template <> struct X { static char* g(); }; template struct X2 {}; template struct X2 { static void f() { X::g(); } }; void a(char *a, char *b) {X2::f();} namespace WonkyAccess { template struct X { int m; }; template class Y; template struct Y : X { }; template<> struct Y : X { }; int f(Y y, Y y2) { return y.m + y2.m; } } // namespace rdar9169404 { template struct X { }; template struct X { typedef int type; }; X::type value; #if __cplusplus >= 201103L // expected-error@-2 {{non-type template argument evaluates to -1, which cannot be narrowed to type 'bool'}} #else // expected-no-diagnostics #endif } // rdar://problem/39524996 namespace rdar39524996 { template struct enable_if_not_same { typedef void type; }; template struct enable_if_not_same; template struct Wrapper { // Assertion triggered on trying to set twice the same partial specialization // enable_if_not_same template Wrapper(const Wrapper& other, typename enable_if_not_same::type* = 0) {} explicit Wrapper(int i) {} }; template struct Container { // It is important that the struct has implicit copy and move constructors. Container() : x() {} template Container(const Container& other) : x(static_cast(other.x)) {} // Implicit constructors are member-wise, so the field triggers instantiation // of T constructors and we instantiate all of them for overloading purposes. T x; }; void takesWrapperInContainer(const Container< Wrapper >& c); void test() { // Type mismatch triggers initialization with conversion which requires // implicit constructors to be instantiated. Container c; takesWrapperInContainer(c); } }