Richard Smith | 762bb9d | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
Peter Collingbourne | 148f1f7 | 2011-03-20 08:06:45 +0000 | [diff] [blame] | 2 | |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 3 | constexpr int x = 1; // expected-note {{variable 'x' declared const here}} |
Peter Collingbourne | 148f1f7 | 2011-03-20 08:06:45 +0000 | [diff] [blame] | 4 | constexpr int id(int x) { return x; } |
| 5 | |
| 6 | void foo(void) { |
Pirama Arumuga Nainar | 33337ca | 2015-05-06 11:48:57 -0700 | [diff] [blame] | 7 | x = 2; // expected-error {{cannot assign to variable 'x' with const-qualified type 'const int'}} |
Peter Collingbourne | 148f1f7 | 2011-03-20 08:06:45 +0000 | [diff] [blame] | 8 | int (*idp)(int) = id; |
| 9 | } |
| 10 | |