Home | History | Annotate | Download | only in PCH
      1 // RUN: %clang_cc1 -pedantic -std=c++1y %s -o %t
      2 // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t
      3 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s
      4 
      5 #ifndef HEADER_INCLUDED
      6 
      7 #define HEADER_INCLUDED
      8 
      9 struct A {
     10   int x;
     11   int y = 3;
     12   int z = x + y;
     13 };
     14 template<typename T> constexpr A make() { return A {}; }
     15 template<typename T> constexpr A make(T t) { return A { t }; }
     16 
     17 struct B {
     18   int z1, z2 = z1;
     19   constexpr B(int k) : z1(k) {}
     20 };
     21 
     22 #else
     23 
     24 static_assert(A{}.z == 3, "");
     25 static_assert(A{1}.z == 4, "");
     26 static_assert(A{.y = 5}.z == 5, ""); // expected-warning {{C99}}
     27 static_assert(A{3, .y = 1}.z == 4, ""); // expected-warning {{C99}}
     28 static_assert(make<int>().z == 3, "");
     29 static_assert(make<int>(12).z == 15, "");
     30 
     31 #endif
     32