summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx0x-constexpr-const.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2015-04-11 01:53:13 +0000
committerRichard Trieu <rtrieu@google.com>2015-04-11 01:53:13 +0000
commitaf7d76c7204c0a586fd38fff45ffe0bd284593b0 (patch)
tree86b043ae62fd707397d6ad449866bad09a260c47 /clang/test/SemaCXX/cxx0x-constexpr-const.cpp
parentd9a21bf93a07994f1564ae3941d95c667cbde448 (diff)
downloadbcm5719-llvm-af7d76c7204c0a586fd38fff45ffe0bd284593b0.tar.gz
bcm5719-llvm-af7d76c7204c0a586fd38fff45ffe0bd284593b0.zip
Improve the error message for assigning to read-only variables.
Previously, many error messages would simply be "read-only variable is not assignable" This change provides more information about why the variable is not assignable, as well as note to where the const is located. Differential Revision: http://reviews.llvm.org/D4479 llvm-svn: 234677
Diffstat (limited to 'clang/test/SemaCXX/cxx0x-constexpr-const.cpp')
-rw-r--r--clang/test/SemaCXX/cxx0x-constexpr-const.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/cxx0x-constexpr-const.cpp b/clang/test/SemaCXX/cxx0x-constexpr-const.cpp
index 197edeb097b..a4398b32a14 100644
--- a/clang/test/SemaCXX/cxx0x-constexpr-const.cpp
+++ b/clang/test/SemaCXX/cxx0x-constexpr-const.cpp
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-constexpr int x = 1;
+constexpr int x = 1; // expected-note {{variable 'x' declared const here}}
constexpr int id(int x) { return x; }
void foo(void) {
- x = 2; // expected-error {{read-only variable is not assignable}}
+ x = 2; // expected-error {{cannot assign to variable 'x' with const-qualified type 'const int'}}
int (*idp)(int) = id;
}
OpenPOWER on IntegriCloud