diff options
Diffstat (limited to 'test/PCH/cxx-templates.cpp')
-rw-r--r-- | test/PCH/cxx-templates.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/test/PCH/cxx-templates.cpp b/test/PCH/cxx-templates.cpp index 05dd6ed..982fc67 100644 --- a/test/PCH/cxx-templates.cpp +++ b/test/PCH/cxx-templates.cpp @@ -1,11 +1,11 @@ // Test this without pch. -// RUN: %clang_cc1 -fexceptions -include %S/cxx-templates.h -verify %s -ast-dump -o - -// RUN: %clang_cc1 -fexceptions -include %S/cxx-templates.h %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx-templates.h -verify %s -ast-dump -o - +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx-templates.h %s -emit-llvm -o - | FileCheck %s // Test with pch. -// RUN: %clang_cc1 -fexceptions -x c++-header -emit-pch -o %t %S/cxx-templates.h -// RUN: %clang_cc1 -fexceptions -include-pch %t -verify %s -ast-dump -o - -// RUN: %clang_cc1 -fexceptions -include-pch %t %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -x c++-header -emit-pch -o %t %S/cxx-templates.h +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include-pch %t -verify %s -ast-dump -o - +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include-pch %t %s -emit-llvm -o - | FileCheck %s // CHECK: define weak_odr void @_ZN2S4IiE1mEv // CHECK: define linkonce_odr void @_ZN2S3IiE1mEv @@ -43,3 +43,22 @@ S7<int[5]> s7_5; namespace ZeroLengthExplicitTemplateArgs { template void f<X>(X*); } + +// This used to overwrite memory and crash. +namespace Test1 { + struct StringHasher { + template<typename T, char Converter(T)> static inline unsigned createHash(const T*, unsigned) { + return 0; + } + }; + + struct CaseFoldingHash { + static inline char foldCase(char) { + return 0; + } + + static unsigned hash(const char* data, unsigned length) { + return StringHasher::createHash<char, foldCase>(data, length); + } + }; +} |