From f20949c9d512ce322bbba7d4427b1ae9ff3794fe Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 10 Jan 2017 02:15:49 +0000 Subject: [PATCH] Don't classify variable template names as type templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291528 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 3 ++- test/SemaCXX/cxx1y-variable-templates_top_level.cpp | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index c32757565d..7cb3adb8d3 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1044,7 +1044,8 @@ Corrected: } // We can have a type template here if we're classifying a template argument. - if (isa(FirstDecl) && !isa(FirstDecl)) + if (isa(FirstDecl) && !isa(FirstDecl) && + !isa(FirstDecl)) return NameClassification::TypeTemplate( TemplateName(cast(FirstDecl))); diff --git a/test/SemaCXX/cxx1y-variable-templates_top_level.cpp b/test/SemaCXX/cxx1y-variable-templates_top_level.cpp index ec3e2b6f63..367f67bf5f 100644 --- a/test/SemaCXX/cxx1y-variable-templates_top_level.cpp +++ b/test/SemaCXX/cxx1y-variable-templates_top_level.cpp @@ -464,3 +464,8 @@ template Variadic_t Variadic; auto variadic1 = Variadic<>; auto variadic2 = Variadic; #endif + +namespace VexingParse { + template int var; // expected-note {{declared here}} + int x(var); // expected-error {{cannot refer to variable template 'var' without a template argument list}} +} -- 2.50.1