Fix a crashing but trying to print a TemplateTemplateParmDecl

for code like this:
   template<template<typename T> class U> class V {};

The problem is that the DeclPrinter assumed all TemplateDecls
have a getTemplatedClass(), but template template params don't
(so we got a NULL dereference).  The solution is to detect if
we're a template template param, and construct the template
class name ('class U') specially in this case.

OKed by dgregor and chandlerc

llvm-svn: 108007
This commit is contained in:
Craig Silverstein 2010-07-09 20:25:10 +00:00
parent d8c60e34da
commit 4a5d086b50
1 changed files with 5 additions and 1 deletions

View File

@ -654,7 +654,11 @@ void DeclPrinter::VisitTemplateDecl(TemplateDecl *D) {
Out << "> ";
Visit(D->getTemplatedDecl());
if (isa<TemplateTemplateParmDecl>(D)) {
Out << "class " << D->getName();
} else {
Visit(D->getTemplatedDecl());
}
}
//----------------------------------------------------------------------------