[cfe-dev] CVR qualifiers not being removed

Vane, Edwin edwin.vane at intel.com
Tue Mar 12 07:37:11 PDT 2013

I have this statement:

const MyType *D = new MyType;

I would expect ASTContext::hasSameUnqualifiedType(VarDecl->getType(), NewExpr->getType()) to return true but it doesn't. I've tried manually to strip off the const qualifier with various other member functions of QualType and Type with no luck. It seems the Type::CanonicalType has the const baked in and every 'get-unqualified' function just returns that internal canonical type with the const stuck in there. Clearly my mental model of how this works is broken. Can someone sort me out?

Edwin Vane
  Software Developer
  Intel of Canada, Inc.

More information about the cfe-dev mailing list