llvm-project/clang/test/SemaCXX/concept-fatal-error.cpp
Younan Zhang 2fd01d75a8 [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
2023-09-01 15:49:39 +08:00

11 lines
450 B
C++

// RUN: %clang_cc1 -fsyntax-only -std=c++20 -ferror-limit 1 -verify %s
template <class>
concept f = requires { 42; };
struct h {
// The missing semicolon will trigger an error and -ferror-limit=1 will make it fatal
// We test that we do not crash in such cases (#55401)
int i = requires { { i } f } // expected-error {{expected ';' at end of declaration list}}
// expected-error@* {{too many errors emitted}}
};