blob: a4398b32a14066b171e6ef25d25cebc04f4cdc0e [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Peter Collingbourne148f1f72011-03-20 08:06:45 +00002
Pirama Arumuga Nainar33337ca2015-05-06 11:48:57 -07003constexpr int x = 1; // expected-note {{variable 'x' declared const here}}
Peter Collingbourne148f1f72011-03-20 08:06:45 +00004constexpr int id(int x) { return x; }
5
6void foo(void) {
Pirama Arumuga Nainar33337ca2015-05-06 11:48:57 -07007 x = 2; // expected-error {{cannot assign to variable 'x' with const-qualified type 'const int'}}
Peter Collingbourne148f1f72011-03-20 08:06:45 +00008 int (*idp)(int) = id;
9}
10