Support the use of "=delete" and "=default" with delayed template

parsing. Fixes <rdar://problem/11700604>.

llvm-svn: 159380
This commit is contained in:
Douglas Gregor 2012-06-28 21:43:01 +00:00
parent d9c8aace7b
commit 1edf57639a
3 changed files with 14 additions and 1 deletions

View File

@ -109,6 +109,7 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS,
// or if we are about to parse function member template then consume
// the tokens and store them for parsing at the end of the translation unit.
if (getLangOpts().DelayedTemplateParsing &&
DefinitionKind == FDK_Definition &&
((Actions.CurContext->isDependentContext() ||
TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate) &&
!Actions.IsInsideALocalClassWithinATemplateFunction())) {

View File

@ -959,6 +959,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
// In delayed template parsing mode, for function template we consume the
// tokens and store them for late parsing at the end of the translation unit.
if (getLangOpts().DelayedTemplateParsing &&
Tok.isNot(tok::equal) &&
TemplateInfo.Kind == ParsedTemplateInfo::Template) {
MultiTemplateParamsArg TemplateParameterLists(Actions,
TemplateInfo.TemplateParams->data(),

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s
// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify -std=c++11 %s
template <class T>
class A {
@ -90,3 +90,14 @@ Callback Bind() {
}
}
namespace rdar11700604 {
template<typename T> void foo() = delete;
struct X {
X() = default;
template<typename T> void foo() = delete;
};
}