From a9d84933107df34f08c201ef6a6f16b354f730da Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 27 May 2011 01:19:52 +0000 Subject: Objective-C doesn't consider the use of incomplete types as method parameter types to be ill-formed. However, it relies on the completeness of method parameter types when producing metadata, e.g., for a protocol, leading IR generating to crash in such cases. Since there's no real way to tighten down the semantics of Objective-C here without breaking existing code, do something safe but lame: suppress the generation of metadata when this happens. Fixes . llvm-svn: 132171 --- clang/lib/Sema/SemaTemplate.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'clang/lib/Sema/SemaTemplate.cpp') diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index d978c389b23..ea084b49ee5 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2867,6 +2867,16 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, if ((*Param)->isTemplateParameterPack()) break; + // If our template is a template template parameter that hasn't acquired + // its proper context yet (e.g., because we're using the template template + // parameter in the signature of a function template, before we've built + // the function template itself), don't attempt substitution of default + // template arguments at this point: we don't have enough context to + // do it properly. + if (isTemplateTemplateParameter && + Template->getDeclContext()->isTranslationUnit()) + break; + // We have a default template argument that we will use. TemplateArgumentLoc Arg; -- cgit v1.2.3