1 // Test this without pch.
2 // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -include %S/cxx-templates.h -verify %s -ast-dump -o -
3 // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -include %S/cxx-templates.h %s -emit-llvm -o - | FileCheck %s
6 // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -x c++-header -emit-pch -o %t %S/cxx-templates.h
7 // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -include-pch %t -verify %s -ast-dump -o -
8 // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -include-pch %t %s -emit-llvm -o - -error-on-deserialized-decl doNotDeserialize | FileCheck %s
10 // expected-no-diagnostics
12 // CHECK: define weak_odr void @_ZN2S4IiE1mEv
13 // CHECK: define linkonce_odr void @_ZN2S3IiE1mEv
19 static T my_templf(T x) { return x; }
22 void test(const int (&a6)[17]) {
23 int x = templ_f<int, 5>(3);
25 S<char, float>::templ();
26 S<int, char>::partial();
27 S<int, float>::explicit_special();
38 S6<const int[17]>::t2 b6 = a6;
41 template struct S4<int>;
45 namespace ZeroLengthExplicitTemplateArgs {
46 template void f<X>(X*);
49 // This used to overwrite memory and crash.
52 template<typename T, char Converter(T)> static inline unsigned createHash(const T*, unsigned) {
57 struct CaseFoldingHash {
58 static inline char foldCase(char) {
62 static unsigned hash(const char* data, unsigned length) {
63 return StringHasher::createHash<char, foldCase>(data, length);
68 template< typename D >
69 Foo< D >& Foo< D >::operator=( const Foo& other )
74 namespace TestNestedExpansion {
77 friend Int operator+(Int, Int);
79 Int &g(Int, int, double);
80 Int &test = NestedExpansion<char, char, char>().f(0, 1, 2, Int(3), 4, 5.0);
83 namespace rdar13135282 {
85 __mt_alloc<> mt = __mt_alloc<>();