[cfe-dev] Const qualifiers on reference types

Richard Smith richard at metafoo.co.uk
Sun Jul 7 16:17:54 PDT 2013


On Sun, Jul 7, 2013 at 3:46 PM, Victor Vicente de Carvalho
<victor.v.carvalho at gmail.com> wrote:
> I'm having a hard time recovering the const qualifier for a function that
> returns a const & QualType. QualType::isConstQualified and
> QualType::isLocalConstQualified are returning false and
> getLocalCVRQualifiers , getCVRQualifiers are returning 0. getNameAsString is
> returning const on the name. There is a different way to recover the
> constness when the object is a reference?

A reference can't be const. Call getPointeeType to find the type that
the reference refers to, and apply isConstQualified to that.



More information about the cfe-dev mailing list