From 486754660bb926339aefcf012a3f848592babb8b Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 28 Jul 2018 11:06:01 +0000 Subject: Vendor import of clang trunk r338150: https://llvm.org/svn/llvm-project/cfe/trunk@338150 --- test/CoverageMapping/classtemplate.cpp | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'test/CoverageMapping/classtemplate.cpp') diff --git a/test/CoverageMapping/classtemplate.cpp b/test/CoverageMapping/classtemplate.cpp index 0ccdcb2431b5..0dbb0c0ede84 100644 --- a/test/CoverageMapping/classtemplate.cpp +++ b/test/CoverageMapping/classtemplate.cpp @@ -2,6 +2,7 @@ // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-CONSTRUCTOR // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-GETTER // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-SETTER +// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-INIT-LIST template class Test { @@ -44,11 +45,51 @@ template class Test3 { void unmangleable(UninstantiatedClassWithTraits x) {} }; +void abort() __attribute__((noreturn)); + +namespace std { +typedef decltype(sizeof(int)) size_t; + +template struct initializer_list { + const E *p; + size_t n; + initializer_list(const E *p, size_t n) : p(p), n(n) {} +}; + +template struct pair { + F f; + S s; + pair(const F &f, const S &s) : f(f), s(s) {} +}; + +struct string { + const char *str; + string() { abort(); } + string(const char *S) : str(S) {} + ~string() { abort(); } +}; + +template +struct map { + using T = pair; + map(initializer_list i, const string &s = string()) {} + ~map() { abort(); } +}; + +}; // namespace std + +// CHECK-INIT-LIST-LABEL: _Z5Test4v: +std::map Test4() { // CHECK-INIT-LIST: File 0, [[@LINE]]:28 -> [[@LINE+3]]:2 = #0 + abort(); + return std::map{{0, 0}}; // CHECK-INIT-LIST-NEXT: [[@LINE]]:3 -> [[@LINE]]:36 = 0 +} + int main() { Test t; t.set(Test::A, 5.5); t.set(Test::T, 5.6); t.set(Test::G, 5.7); t.set(Test::C, 5.8); + Test4(); return 0; } -- cgit v1.3