Clang Project

clang_source_code/test/SemaCXX/cxx0x-constexpr-const.cpp
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2
3constexpr int x = 1;  // expected-note {{variable 'x' declared const here}}
4constexpr int id(int x) { return x; }
5
6void foo(void) {
7  x = 2; // expected-error {{cannot assign to variable 'x' with const-qualified type 'const int'}}
8  int (*idp)(int) = id;
9}
10
11