[clang] Construct ExprRequirement with SubstitutionDiagnostic on SubstFailure
authorYounan Zhang <zyn7109@gmail.com>
Wed, 16 Aug 2023 07:33:58 +0000 (15:33 +0800)
committerTobias Hieta <tobias@hieta.se>
Tue, 5 Sep 2023 07:00:27 +0000 (09:00 +0200)
commitc2c9c0f1388e435c4b2416d658ea005d5e724202
tree4f9a71d0301153911546204e1a9aa614ebf87552
parent175a130b9f84583267ba04c3298cd73b02d5b76a
[clang] Construct ExprRequirement with SubstitutionDiagnostic on SubstFailure

We're expecting a SubstitutionDiagnostic in diagnoseUnsatisfiedRequirement
if the status of ExprRequirement is SubstFailure. Previously, the Requirement
was created with Expr on SubstFailure by mistake, which could lead to the
assertion failure in the subsequent diagnosis.

Fixes https://github.com/clangd/clangd/issues/1726
Fixes https://github.com/llvm/llvm-project/issues/64723
Fixes https://github.com/llvm/llvm-project/issues/64172

In addition, this patch also fixes an invalid test from D129499.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D158061
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/ExprConcepts.h
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/test/SemaCXX/concept-crash-on-diagnostic.cpp [new file with mode: 0644]
clang/test/SemaCXX/concept-fatal-error.cpp