diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-11-18 20:55:52 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-11-18 20:55:52 +0000 |
commit | 65bdbfa6ca6b9a1170e052cc567d098d0f99cdae (patch) | |
tree | d19d5f04ddefd75a1b6817aa5986f6aad1ceda70 /lib/Sema/SemaOverload.cpp | |
parent | a9efadada0430493a4d68b34b2e76580d0fd8f10 (diff) |
Pretend destructors are const and volatile. This allows calling them with const and/or volatile objects. Fixes PR5548.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 916fe57192..a86b57c0d8 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -2090,8 +2090,11 @@ bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType, ImplicitConversionSequence Sema::TryObjectArgumentInitialization(Expr *From, CXXMethodDecl *Method) { QualType ClassType = Context.getTypeDeclType(Method->getParent()); - QualType ImplicitParamType - = Context.getCVRQualifiedType(ClassType, Method->getTypeQualifiers()); + // [class.dtor]p2: A destructor can be invoked for a const, volatile or + // const volatile object. + unsigned Quals = isa<CXXDestructorDecl>(Method) ? + Qualifiers::Const | Qualifiers::Volatile : Method->getTypeQualifiers(); + QualType ImplicitParamType = Context.getCVRQualifiedType(ClassType, Quals); // Set up the conversion sequence as a "bad" conversion, to allow us // to exit early. @@ -2106,7 +2109,7 @@ Sema::TryObjectArgumentInitialization(Expr *From, CXXMethodDecl *Method) { assert(FromType->isRecordType()); - // The implicit object parmeter is has the type "reference to cv X", + // The implicit object parameter is has the type "reference to cv X", // where X is the class of which the function is a member // (C++ [over.match.funcs]p4). However, when finding an implicit // conversion sequence for the argument, we are not allowed to |