mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Destructors are neither const nor volatile, bug 269655.
This commit is contained in:
parent
b90a03c48b
commit
dfc2eb9c52
3 changed files with 4 additions and 7 deletions
|
@ -133,8 +133,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
|||
|
||||
if (!ia.hasUserDeclaredDestructor()) {
|
||||
//destructor: ~A()
|
||||
// a destructor can be called for const and volatile objects
|
||||
ICPPFunctionType ft= CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_unspecified, 0), voidPs, true, true);
|
||||
ICPPFunctionType ft= CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_unspecified, 0), voidPs, false, false);
|
||||
char[] dtorName = CharArrayUtils.concat("~".toCharArray(), className); //$NON-NLS-1$
|
||||
ICPPMethod m = new CPPImplicitMethod(this, dtorName, ft, voidPs);
|
||||
implicits[i++] = m;
|
||||
|
|
|
@ -2200,7 +2200,8 @@ public class CPPSemantics {
|
|||
|
||||
final IType thisType = data.getImpliedObjectArgument();
|
||||
|
||||
if (ASTInternal.isStatic(fn, false)) {
|
||||
if (fn instanceof ICPPMethod &&
|
||||
(((ICPPMethod) fn).isDestructor() || ASTInternal.isStatic(fn, false))) {
|
||||
// 13.3.1-4 for static member functions, the implicit object parameter always matches, no cost
|
||||
cost = new Cost(thisType, implicitType, Rank.IDENTITY);
|
||||
} else if (thisType == null) {
|
||||
|
|
|
@ -1558,10 +1558,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
returnType = getPointerTypes(returnType, fnDtor);
|
||||
}
|
||||
|
||||
// a destructor can be called for const and volatile objects
|
||||
final char[] lookupKey = name.getLookupKey();
|
||||
final boolean isDestructor= lookupKey.length > 0 && lookupKey[0]=='~';
|
||||
IType type = new CPPFunctionType(returnType, pTypes, isDestructor || fnDtor.isConst(), isDestructor || fnDtor.isVolatile());
|
||||
IType type = new CPPFunctionType(returnType, pTypes, fnDtor.isConst(), fnDtor.isVolatile());
|
||||
final IASTDeclarator nested = fnDtor.getNestedDeclarator();
|
||||
if (nested != null) {
|
||||
return createType(type, nested);
|
||||
|
|
Loading…
Add table
Reference in a new issue