aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/i-c-e-cxx.cpp
blob: b7db907e2216d9369be730c6c775b2b1a8333a0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: clang-cc -fsyntax-only -verify %s

// C++-specific tests for integral constant expressions.

const int c = 10;
int ar[c];

struct X0 {
  static const int value = static_cast<int>(4.0);
};

void f() {
  if (const int value = 17) {
    int array[value];
  }
}

int a() {
  const int t=t; // expected-note {{subexpression not valid}}
  switch(1) {
    case t:; // expected-error {{not an integer constant expression}}
  }
}