mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-25 06:18:56 -04:00

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
11 lines
314 B
C++
11 lines
314 B
C++
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
|
|
|
|
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 {{cannot assign to variable 'x' with const-qualified type 'const int'}}
|
|
int (*idp)(int) = id;
|
|
}
|
|
|