diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:08 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:08 +0000 | 
| commit | bab175ec4b075c8076ba14c762900392533f6ee4 (patch) | |
| tree | 01f4f29419a2cb10abe13c1e63cd2a66068b0137 /test/PCH/cxx1y-default-initializer.cpp | |
| parent | 8b7a8012d223fac5d17d16a66bb39168a9a1dfc0 (diff) | |
Notes
Diffstat (limited to 'test/PCH/cxx1y-default-initializer.cpp')
| -rw-r--r-- | test/PCH/cxx1y-default-initializer.cpp | 27 | 
1 files changed, 21 insertions, 6 deletions
diff --git a/test/PCH/cxx1y-default-initializer.cpp b/test/PCH/cxx1y-default-initializer.cpp index 1f8d9a5d08d8e..c9593a56d2e2d 100644 --- a/test/PCH/cxx1y-default-initializer.cpp +++ b/test/PCH/cxx1y-default-initializer.cpp @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -pedantic -std=c++1y %s -o %t -// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t -// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s +// RUN: %clang_cc1 -pedantic -std=c++1y -include %s -include %s -verify %s +// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch -o %t.1 %s +// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.1 -emit-pch -o %t.2 %s +// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.2 -verify %s -#ifndef HEADER_INCLUDED - -#define HEADER_INCLUDED +#ifndef HEADER_1 +#define HEADER_1  struct A {    int x; @@ -19,6 +19,20 @@ struct B {    constexpr B(int k) : z1(k) {}  }; +template<typename T> struct C { +  constexpr C() {} +  T c = T(); +  struct U {}; +}; +// Instantiate C<int> but not the default initializer. +C<int>::U ciu; + +#elif !defined(HEADER_2) +#define HEADER_2 + +// Instantiate the default initializer now, should create an update record. +C<int> ci; +  #else  static_assert(A{}.z == 3, ""); @@ -27,5 +41,6 @@ static_assert(A{.y = 5}.z == 5, ""); // expected-warning {{C99}}  static_assert(A{3, .y = 1}.z == 4, ""); // expected-warning {{C99}}  static_assert(make<int>().z == 3, "");  static_assert(make<int>(12).z == 15, ""); +static_assert(C<int>().c == 0, "");  #endif  | 
