From 6e91f4bd9a05ca2c58ba11d541d8f9dab5514b76 Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Wed, 19 Jun 2013 22:25:01 +0000 Subject: [PATCH] Fix for PR 16367, display the name of a function in a diagnostic instead of showing "(null)". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184377 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseDeclCXX.cpp | 2 +- test/Parser/cxx-class-template-specialization.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/Parser/cxx-class-template-specialization.cpp diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 71ee3118c9..f09aaf5c0b 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1272,7 +1272,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, Range.setBegin(SS.getBeginLoc()); Diag(TemplateId->LAngleLoc, diag::err_template_spec_syntax_non_template) - << Name << static_cast(TemplateId->Kind) << Range; + << TemplateId->Name << static_cast(TemplateId->Kind) << Range; DS.SetTypeSpecError(); SkipUntil(tok::semi, false, true); diff --git a/test/Parser/cxx-class-template-specialization.cpp b/test/Parser/cxx-class-template-specialization.cpp new file mode 100644 index 0000000000..f94a85964a --- /dev/null +++ b/test/Parser/cxx-class-template-specialization.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct A { + template + void f(); +}; +class A::f; +// expected-error@-1 {{identifier followed by '<' indicates a class template specialization but 'f' refers to a function template}} -- 2.50.1