Clang currently ignores a const qualifier of a method receiver when the method is invoked through
a method pointer, and the invocation implies an implicit cast to the parent class, which hurts the
const correctness. This patch fixes it by restoring the qualifier on the parent class from the child class.
Details
Details
Diff Detail
Diff Detail
- Build Status
Buildable 7004 Build 7004: arc lint + arc unit
Event Timeline
lib/Sema/SemaExprCXX.cpp | ||
---|---|---|
5108 | In the "indirect" case, the cv-qualifiers should be taken from the pointee type of the LHS and applied to the pointee type of UseType. I believe this patch will not be enough to cause us to reject the indirect version of your testcase: ((&b)->*&B::f)(); // expected-error{{drops 'const' qualifier}} Moreover, we should be preserving all qualifiers, not just cvr-qualifiers; for example, this should also preserve the address space. |
lib/Sema/SemaExprCXX.cpp | ||
---|---|---|
5108 | Make sense. OK, I updated the CL to cover that cases. |
In the "indirect" case, the cv-qualifiers should be taken from the pointee type of the LHS and applied to the pointee type of UseType. I believe this patch will not be enough to cause us to reject the indirect version of your testcase:
Moreover, we should be preserving all qualifiers, not just cvr-qualifiers; for example, this should also preserve the address space.