[PATCH] D132821: [clang][Parse] Fix crash when emitting template diagnostic

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 30 06:12:47 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGef1bb11a34de: [clang][Parse] Fix crash when emitting template diagnostic (authored by tbaeder).

Changed prior to commit:
  https://reviews.llvm.org/D132821?vs=456389&id=456643#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132821/new/

https://reviews.llvm.org/D132821

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/test/Parser/cxx-concept-declaration.cpp


Index: clang/test/Parser/cxx-concept-declaration.cpp
===================================================================
--- clang/test/Parser/cxx-concept-declaration.cpp
+++ clang/test/Parser/cxx-concept-declaration.cpp
@@ -1,7 +1,12 @@
 
 // Support parsing of concepts
 // Disabled for now.
-// expected-no-diagnostics
 
-// RUN:  %clang_cc1 -std=c++14 -x c++ -verify %s
-// template<typename T> concept C1 = true;
+// RUN:  %clang_cc1 -std=c++20 -x c++ -verify %s
+template<typename T> concept C1 = true;
+
+template<class T>
+concept C = true;
+
+template<class T>
+class C<int> {}; //expected-error{{identifier followed by '<' indicates a class template specialization but 'C' refers to a concept}}
Index: clang/include/clang/Basic/DiagnosticParseKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticParseKinds.td
+++ clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -775,7 +775,8 @@
 def err_template_spec_syntax_non_template : Error<
   "identifier followed by '<' indicates a class template specialization but "
   "%0 %select{does not refer to a template|refers to a function template|"
-  "<unused>|refers to a variable template|<unused>|refers to a concept}1">;
+  "<unused>|refers to a variable template|<unused>|<unused>|"
+  "refers to a concept}1">;
 def err_id_after_template_in_nested_name_spec : Error<
   "expected template name after 'template' keyword in nested name specifier">;
 def err_unexpected_template_in_unqualified_id : Error<
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -84,6 +84,8 @@
 - Fix assert that triggers a crash during template name lookup when a type was
   incomplete but was not also a TagType. This fixes
   `Issue 57387 <https://github.com/llvm/llvm-project/issues/57387>`_.
+- Fix a crash when emitting a concept-related diagnostic. This fixes
+  `Issue 57415 <https://github.com/llvm/llvm-project/issues/57415>`_.
 
 
 Improvements to Clang's diagnostics


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132821.456643.patch
Type: text/x-patch
Size: 2097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220830/ab6d3fe1/attachment.bin>


More information about the cfe-commits mailing list