xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/cxx-static_assert.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Test this without pch.
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include %s -verify -std=c++11 %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // Test with pch.
5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s
6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include-pch %t -verify -std=c++11 %s
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc #ifndef HEADER
9*f4a2713aSLionel Sambuc #define HEADER
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc template<int N> struct T {
12*f4a2713aSLionel Sambuc     static_assert(N == 2, "N is not 2!");
13*f4a2713aSLionel Sambuc };
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc #else
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc // expected-error@12 {{static_assert failed "N is not 2!"}}
18*f4a2713aSLionel Sambuc T<1> t1; // expected-note {{in instantiation of template class 'T<1>' requested here}}
19*f4a2713aSLionel Sambuc T<2> t2;
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc #endif
22