[LLVMbugs] [Bug 20283] New: read-only variable is not assignable warning could be clearer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 10 13:13:24 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20283

            Bug ID: 20283
           Summary: read-only variable is not assignable warning could be
                    clearer
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: echristo at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

With this code:

class T {
  int a;
  int *c;

  void resetC() const {
    c = &a;
  }
};

T t;

you get:

dzur:~> ~/builds/build-llvm/Debug+Asserts/bin/clang -c foo.cpp
foo.cpp:6:7: error: read-only variable is not assignable
    c = &a;
    ~ ^
1 error generated.

which is perfectly correct - but doesn't really help me know why it isn't
assignable. Perhaps we could point to the const on the function, or something
similar?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140710/8c3b12a6/attachment.html>


More information about the llvm-bugs mailing list