[PATCH] Add more information when displaying a "read-only variable is not assignable" error

David Blaikie dblaikie at gmail.com
Mon Jul 14 09:51:18 PDT 2014


An out-of-line definition might be interesting:

  struct foo {
    int i;
    void f() const;
  };
  void foo::f() cont {
    i = 3;
  }

does the diagnostic point to the definition of 'f' or the declaration?

Also, would it be better for the diagnostic to point to the "const" in the function rather than the "f"?

"of type 'const T' which is const" sounds a bit strange - any better way we could phrase this? Could we leverage/improve type diffing to allow a silent (silent in the sense that the non-const type is not printed in the diagnostic) comparison to the non-const type? ("X is declared with type '<const> int' here"?) Not sure how it would/should look when typedefs are involved.

http://reviews.llvm.org/D4479






More information about the cfe-commits mailing list