]> granicus.if.org Git - clang/commitdiff
Fix for PR 16367, display the name of a function in a diagnostic instead of
authorRichard Trieu <rtrieu@google.com>
Wed, 19 Jun 2013 22:25:01 +0000 (22:25 +0000)
committerRichard Trieu <rtrieu@google.com>
Wed, 19 Jun 2013 22:25:01 +0000 (22:25 +0000)
showing "(null)".

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

lib/Parse/ParseDeclCXX.cpp
test/Parser/cxx-class-template-specialization.cpp [new file with mode: 0644]

index 71ee3118c9a0ee91cb9cca4b53a1855ffdc685ee..f09aaf5c0bbffce196f265f0d093990820c2d286 100644 (file)
@@ -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<int>(TemplateId->Kind) << Range;
+        << TemplateId->Name << static_cast<int>(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 (file)
index 0000000..f94a859
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {
+  template<typename T>
+  void f();
+};
+class A::f<int>;
+// expected-error@-1 {{identifier followed by '<' indicates a class template specialization but 'f' refers to a function template}}