mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-14 14:56:47 +00:00
27037: Use correct CVR qualifier on an upcast on method pointer call
Patch by Taiju Tsuiki! Differential Revision: https://reviews.llvm.org/D33875 llvm-svn: 305126
This commit is contained in:
parent
c4c33ce097
commit
01e4a7f29b
@ -5106,7 +5106,9 @@ QualType Sema::CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS,
|
||||
return QualType();
|
||||
|
||||
// Cast LHS to type of use.
|
||||
QualType UseType = isIndirect ? Context.getPointerType(Class) : Class;
|
||||
QualType UseType = Context.getQualifiedType(Class, LHSType.getQualifiers());
|
||||
if (isIndirect)
|
||||
UseType = Context.getPointerType(UseType);
|
||||
ExprValueKind VK = isIndirect ? VK_RValue : LHS.get()->getValueKind();
|
||||
LHS = ImpCastExprToType(LHS.get(), UseType, CK_DerivedToBase, VK,
|
||||
&BasePath);
|
||||
|
13
clang/test/SemaCXX/PR27037.cpp
Normal file
13
clang/test/SemaCXX/PR27037.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
|
||||
struct A {
|
||||
void f();
|
||||
};
|
||||
|
||||
struct B : A {};
|
||||
|
||||
void m() {
|
||||
const B b;
|
||||
(b.*&B::f)(); // expected-error{{drops 'const' qualifier}}
|
||||
((&b)->*&B::f)(); // expected-error{{drops 'const' qualifier}}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user