From 9303357e73d034b9f22b459f92028583231e8746 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 27 Jul 2014 05:38:12 +0000 Subject: [PATCH] Fix default argument comma disambiguation bug following the 'template' keyword. llvm-svn: 214051 --- clang/lib/Parse/ParseCXXInlineMethods.cpp | 1 + clang/test/Parser/cxx-ambig-init-templ.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 30a9120a5106..55caa5e59f6e 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -1014,6 +1014,7 @@ bool Parser::ConsumeAndStoreInitializer(CachedTokens &Toks, Toks.push_back(Tok); ConsumeToken(); if (Tok.is(tok::less)) { + ++AngleCount; ++KnownTemplateCount; Toks.push_back(Tok); ConsumeToken(); diff --git a/clang/test/Parser/cxx-ambig-init-templ.cpp b/clang/test/Parser/cxx-ambig-init-templ.cpp index ac79f77e152d..1f692664137c 100644 --- a/clang/test/Parser/cxx-ambig-init-templ.cpp +++ b/clang/test/Parser/cxx-ambig-init-templ.cpp @@ -169,3 +169,9 @@ namespace ElaboratedTypeSpecifiers { enum E {}; }; } + +namespace PR20459 { + template struct A { + void foo(int = EncTraits::template TypeEnc::val); // ok + }; +}