diff options
author | Richard Trieu <rtrieu@google.com> | 2015-04-11 01:53:13 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2015-04-11 01:53:13 +0000 |
commit | af7d76c7204c0a586fd38fff45ffe0bd284593b0 (patch) | |
tree | 86b043ae62fd707397d6ad449866bad09a260c47 /clang/test/SemaCXX/cxx0x-constexpr-const.cpp | |
parent | d9a21bf93a07994f1564ae3941d95c667cbde448 (diff) | |
download | bcm5719-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.cpp | 4 |
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; } |