http://llvm.org/bugs/show_bug.cgi?id=19139
Bug ID: 19139
Summary: explain why a variable is const
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Clang should explain why a variable is read-only.
nlewycky@ducttape:~$ cat c.cc
const int k = 1;
void f() { k = 0; }
class X {
int i;
const int j = 1;
void f() const { i = 0; }
void g() { j = 0; }
};
nlewycky@ducttape:~$ llvm/Debug+Asserts/bin/clang c.cc -std=c++11
c.cc:2:14: error: read-only variable is not assignable
void f() { k = 0; }
~ ^
c.cc:6:22: error: read-only variable is not assignable
void f() const { i = 0; }
~ ^
c.cc:7:16: error: read-only variable is not assignable
void g() { j = 0; }
~ ^
3 errors generated.
There are const's to point to in each of those cases.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs