[cfe-commits] PATCH: Partial fix for the first half of PR5542

Eli Friedman eli.friedman at gmail.com
Mon Dec 28 15:52:33 PST 2009


On Mon, Dec 28, 2009 at 2:48 PM, Chandler Carruth <chandlerc at google.com> wrote:
> This patch addresses the first half of PR5542; failure to promote CVR
> qualifiers on the element type to the array type when checking whether
> they are more (or less) cv-qualified than another type.
> ([basic.type.qualifier] p5, final sentence) I've done this by
> refactoring the logic which existed in the internals of template
> deduction to do this transformation into the ASTContext. I considered
> QualType and CanQual<T>, but neither seemed as good of a fit. It might
> be better to accept a CanQualType input instead of a QualType  which
> we immediately assert is canonical, but that involved more changes to
> existing code, so I left it out. I'm also not sure that we can
> correctly return a CanQualType, and it seemed better to convert to
> QualType immediately in that case. There are a few more places we need
> to use this that I'm still isolating and writing test cases, but they
> can go in as follow-up submissions.

It seems weird to be intentionally constructing non-canonical types in
code that otherwise works with canonical types. (The canonical version
puts all qualifiers on the element type.)  It would be nice if you
could restructure the code to avoid that, or at least note that you're
doing it intentionally.

If you haven't spotted it, PR5897 is a related issue.

Otherwise, the patch looks fine.

-Eli




More information about the cfe-commits mailing list