[PATCH] D33875: PR27037: Use correct CVR qualifier on an upcast on method pointer call

Taiju Tsuiki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 04:02:20 PDT 2017


tzik marked an inline comment as done.
tzik added inline comments.


================
Comment at: lib/Sema/SemaExprCXX.cpp:5108
     QualType UseType = isIndirect ? Context.getPointerType(Class) : Class;
+    UseType = UseType.withCVRQualifiers(LHS.get()->getType().getCVRQualifiers());
     ExprValueKind VK = isIndirect ? VK_RValue : LHS.get()->getValueKind();
----------------
rsmith wrote:
> 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.
Make sense. OK, I updated the CL to cover that cases.
Could you take another look?


https://reviews.llvm.org/D33875





More information about the cfe-commits mailing list