diff options
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 5 | ||||
-rw-r--r-- | test/SemaObjCXX/delay-parsing-cfunctions.mm | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 05d44a5af0..38aff5d4b9 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1340,9 +1340,12 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, // Look at the next token to make sure that this isn't a function // declaration. We have to check this because __attribute__ might be the // start of a function definition in GCC-extended K&R C. + // FIXME. Delayed parsing not done for c/c++ functions nested in namespace !isDeclarationAfterDeclarator() && (!CurParsedObjCImpl || Tok.isNot(tok::l_brace) || - (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()))) { + (getLangOpts().CPlusPlus && + (D.getCXXScopeSpec().isSet() || + !Actions.CurContext->isTranslationUnit())))) { if (isStartOfFunctionDefinition(D)) { if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) { diff --git a/test/SemaObjCXX/delay-parsing-cfunctions.mm b/test/SemaObjCXX/delay-parsing-cfunctions.mm index fbdf8bad0a..fa65dbea9e 100644 --- a/test/SemaObjCXX/delay-parsing-cfunctions.mm +++ b/test/SemaObjCXX/delay-parsing-cfunctions.mm @@ -41,4 +41,8 @@ int x{17}; X::X() = default; void X::SortWithCollator() {} +// pr13418 +namespace { + int CurrentTabId() {return 0;} +} @end |