[cfe-commits] Fix PR13434 - mangling of templates with function pointers as arguments
John McCall
rjmccall at apple.com
Mon Jul 30 17:56:22 PDT 2012
On Jul 27, 2012, at 7:30 AM, Timur Iskhodzhanov wrote:
> Attached is an updated patch which has slightly uglier code (due to
> code duplication) but better mangling.
> The "eta" mangling remains the same, "_E$$A6" has been replaced with
> "_E" everywhere.
+ QualType pointee = T->getPointeeType();
+ assert(isa<FunctionProtoType>(pointee));
+ mangleType(static_cast<const FunctionProtoType*>(pointee.getTypePtr()), NULL, false, false);
The easier way to do an assert-and-cast is like this:
cast<FunctionProtoType>(pointee)
However, you can't actually do a cast here, because there could be a typedef in the way. Test case:
typedef void fn();
void foo(fn^ block) { block(); }
So instead you need to do this:
pointee->castAs<FunctionProtoType>()
This is like getAs<>, but asserting.
John.
More information about the cfe-commits
mailing list