Add LLVM runtime checks to build path
[clang/acc.git] / test / SemaCXX / static-assert.cpp
blobcaf76033af704fe80052e565acb570de63fed81f
1 // RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
3 int f();
5 static_assert(f(), "f"); // expected-error {{static_assert expression is not an integral constant expression}}
6 static_assert(true, "true is not false");
7 static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
9 void g() {
10 static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
13 class C {
14 static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
17 template<int N> struct T {
18 static_assert(N == 2, "N is not 2!"); // expected-error {{static_assert failed "N is not 2!"}}
21 T<1> t1; // expected-note {{in instantiation of template class 'struct T<1>' requested here}}
22 T<2> t2;
24 template<typename T> struct S {
25 static_assert(sizeof(T) > sizeof(char), "Type not big enough!"); // expected-error {{static_assert failed "Type not big enough!"}}
28 S<char> s1; // expected-note {{in instantiation of template class 'struct S<char>' requested here}}
29 S<int> s2;