[PATCH] Improving printed template names in diagnostic messages
Richard Smith
richard at metafoo.co.uk
Wed Mar 20 17:32:59 PDT 2013
================
Comment at: include/clang/AST/Type.h:3453-3460
@@ -3451,8 +3452,10 @@
- SubstTemplateTypeParmType(const TemplateTypeParmType *Param, QualType Canon)
- : Type(SubstTemplateTypeParm, Canon, Canon->isDependentType(),
- Canon->isInstantiationDependentType(),
- Canon->isVariablyModifiedType(),
- Canon->containsUnexpandedParameterPack()),
- Replaced(Param) { }
+ SubstTemplateTypeParmType(const TemplateTypeParmType *Param,
+ QualType Replacement)
+ : Type(SubstTemplateTypeParm, Replacement.getCanonicalType(),
+ Replacement->isDependentType(),
+ Replacement->isInstantiationDependentType(),
+ Replacement->isVariablyModifiedType(),
+ Replacement->containsUnexpandedParameterPack()),
+ Replaced(Param), ReplacementType(Replacement) { }
----------------
How does this deal with templates which are instantiated multiple times with equivalent, but differently-sugared, types? For instance:
template<typename T> struct A { T val; };
typedef int T1;
A<T1> a;
typedef int T2;
char &r = A<T2>().val;
... does this produce a message about T1?
I think for this case we still want to substitute the canonical type into the template, and recover sugar based on the context of use.
http://llvm-reviews.chandlerc.com/D562
More information about the cfe-commits
mailing list