blob: 8c70bc258701c298a5f038707b108746ebf6de8c [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Sebastian Redl4a4251b2009-02-07 13:06:23 +00002
3// C++-specific tests for integral constant expressions.
4
5const int c = 10;
6int ar[c];
Douglas Gregor59600d82009-09-10 17:44:23 +00007
8struct X0 {
9 static const int value = static_cast<int>(4.0);
10};
Douglas Gregorf2991242009-09-10 23:31:45 +000011
12void f() {
13 if (const int value = 17) {
14 int array[value];
15 }
16}
Eli Friedmanc0131182009-12-03 20:31:57 +000017
18int a() {
19 const int t=t; // expected-note {{subexpression not valid}}
20 switch(1) {
21 case t:; // expected-error {{not an integer constant expression}}
22 }
23}