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