]> granicus.if.org Git - clang/commitdiff
Support the use of "=delete" and "=default" with delayed template
authorDouglas Gregor <dgregor@apple.com>
Thu, 28 Jun 2012 21:43:01 +0000 (21:43 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 28 Jun 2012 21:43:01 +0000 (21:43 +0000)
parsing. Fixes <rdar://problem/11700604>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159380 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseCXXInlineMethods.cpp
lib/Parse/Parser.cpp
test/Parser/DelayedTemplateParsing.cpp

index 131c6b654612ce4ef8266312cdd82a6c77b6ed86..abce27c3f820df0768d3b215f4e91c0856ae634f 100644 (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())) {
index 5b5d52b2233177b43181df4454d0a71eb775363c..bec6dd717c6529ac192d4cd6a6c549fdb54359cc 100644 (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(),
index 9737c731bd170cbdf3616d9e44523a9deea5545b..77b47239f4c8baae8e9c64bacc05576f65525935 100644 (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;
+  };
+}
+