Home | History | Annotate | Download | only in PCH
      1 // RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t
      2 // RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s
      3 
      4 #ifndef HEADER_INCLUDED
      5 
      6 #define HEADER_INCLUDED
      7 
      8 struct B {
      9   B();
     10   constexpr B(char) {}
     11 };
     12 
     13 struct C {
     14   B b;
     15   double d = 0.0;
     16 };
     17 
     18 struct D : B {
     19   constexpr D(int n) : B('x'), k(2*n+1) {}
     20   int k;
     21 };
     22 
     23 #else
     24 
     25 static_assert(D(4).k == 9, "");
     26 constexpr int f(C c) { return 0; } // expected-error {{not a literal type}}
     27 // expected-note@13 {{not an aggregate and has no constexpr constructors}}
     28 constexpr B b; // expected-error {{constant expression}} expected-note {{non-constexpr}}
     29                // expected-note@9 {{here}}
     30 
     31 #endif
     32