[cfe-dev] CVR qualifiers not being removed

Vane, Edwin edwin.vane at intel.com
Tue Mar 12 08:25:27 PDT 2013

Coffee was the necessary solution here. Sorry for the noise. My brain was seeing:

Const MyType *D =...


MyType * const D = ...

-----Original Message-----
From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Vane, Edwin
Sent: Tuesday, March 12, 2013 10:37 AM
To: Clang Dev List (cfe-dev at cs.uiuc.edu)
Subject: [cfe-dev] CVR qualifiers not being removed

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.

cfe-dev mailing list
cfe-dev at cs.uiuc.edu

More information about the cfe-dev mailing list