diff options
author | cor3ntin <corentinjabot@gmail.com> | 2025-05-24 10:36:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-24 10:36:18 +0200 |
commit | 0804ca88abbfc5951be1e3f2ccb4fe7d46c3a410 (patch) | |
tree | f170e6bc270d77fde503cb823ed5b09f5dd8cb71 /clang/lib/Sema/SemaConcept.cpp | |
parent | a6ca7036a1147f5930714ff02ee3951755ab712d (diff) | |
download | llvm-0804ca88abbfc5951be1e3f2ccb4fe7d46c3a410.zip llvm-0804ca88abbfc5951be1e3f2ccb4fe7d46c3a410.tar.gz llvm-0804ca88abbfc5951be1e3f2ccb4fe7d46c3a410.tar.bz2 |
[Clang] Explain why a type trait evaluated to false. (#141238)
`static_assert(std::is_xx_v<MyType>);` is a common pattern to check that
a type meets a requirement.
This patch produces diagnostics notes when such assertion fails. The
first type trait for which we provide detailed explanation is
std::is_trivially_relocatable.
We employ the same mechanisn when a type trait appears an an unsatisfied
atomic constraint.
I plan to also support `std::is_trivially_replaceable` in a follow up
PR, and hopefully, over time we can support more type traits.
Diffstat (limited to 'clang/lib/Sema/SemaConcept.cpp')
-rw-r--r-- | clang/lib/Sema/SemaConcept.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 7da8e69..c6a54dc 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -1320,6 +1320,7 @@ static void diagnoseWellFormedUnsatisfiedConstraintExpr(Sema &S, S.Diag(SubstExpr->getSourceRange().getBegin(), diag::note_atomic_constraint_evaluated_to_false) << (int)First << SubstExpr; + S.DiagnoseTypeTraitDetails(SubstExpr); } template <typename SubstitutionDiagnostic> |