blob: 62208cd2aeebedc1ba663437a18799e1be87eb14 [file] [log] [blame]
Shih-wei Liaof8fd82b2010-02-10 11:10:31 -08001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
2
3int f();
4
5static_assert(f(), "f"); // expected-error {{static_assert expression is not an integral constant expression}}
6static_assert(true, "true is not false");
7static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
8
9void g() {
10 static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
11}
12
13class C {
14 static_assert(false, "false is false"); // expected-error {{static_assert failed "false is false"}}
15};
16
17template<int N> struct T {
18 static_assert(N == 2, "N is not 2!"); // expected-error {{static_assert failed "N is not 2!"}}
19};
20
21T<1> t1; // expected-note {{in instantiation of template class 'struct T<1>' requested here}}
22T<2> t2;
23
24template<typename T> struct S {
25 static_assert(sizeof(T) > sizeof(char), "Type not big enough!"); // expected-error {{static_assert failed "Type not big enough!"}}
26};
27
28S<char> s1; // expected-note {{in instantiation of template class 'struct S<char>' requested here}}
29S<int> s2;
30