diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-04-26 06:23:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-26 06:23:34 +0200 |
commit | a50269e9991a9b50790cd556eb2bc1417f7e7407 (patch) | |
tree | a8567edf49768b21e3b38df18892372202ecdf97 /clang/lib/AST/ByteCode/Compiler.cpp | |
parent | b81947e589a7960b3f8f7c4403fe24319565266e (diff) | |
download | llvm-a50269e9991a9b50790cd556eb2bc1417f7e7407.zip llvm-a50269e9991a9b50790cd556eb2bc1417f7e7407.tar.gz llvm-a50269e9991a9b50790cd556eb2bc1417f7e7407.tar.bz2 |
[clang][bytecode] Diagnose dynamic_cast before C++20 (#137442)
Emit a CCE diagnostic.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index fd306c0..58fe2c1 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -3012,6 +3012,17 @@ bool Compiler<Emitter>::VisitCXXReinterpretCastExpr( } template <class Emitter> +bool Compiler<Emitter>::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *E) { + + if (!Ctx.getLangOpts().CPlusPlus20) { + if (!this->emitInvalidCast(CastKind::Dynamic, /*Fatal=*/false, E)) + return false; + } + + return this->VisitCastExpr(E); +} + +template <class Emitter> bool Compiler<Emitter>::VisitCXXNoexceptExpr(const CXXNoexceptExpr *E) { assert(E->getType()->isBooleanType()); |