llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/242231.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Compiler.cpp (+3) - (modified) clang/test/AST/ByteCode/typeid.cpp (+10) ``````````diff diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index e3232d943ee4d..5044656e3afff 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -4583,6 +4583,9 @@ bool Compiler<Emitter>::VisitBlockExpr(const BlockExpr *E) { template <class Emitter> bool Compiler<Emitter>::VisitCXXTypeidExpr(const CXXTypeidExpr *E) { + if (E->containsErrors()) + return false; + const Type *TypeInfoType = E->getType().getTypePtr(); auto canonType = [](const Type *T) { diff --git a/clang/test/AST/ByteCode/typeid.cpp b/clang/test/AST/ByteCode/typeid.cpp index 4b9c024632354..99a864432f1ac 100644 --- a/clang/test/AST/ByteCode/typeid.cpp +++ b/clang/test/AST/ByteCode/typeid.cpp @@ -111,3 +111,13 @@ namespace TypeIdInOtherStruct { auto &zti = typeid(z.y); static_assert(&zti == &typeid(Y)); } + +/// CXXTypeIdExpr containing errors. +namespace std { +struct type_info struct S { // both-error {{cannot combine with previous 'struct' declaration specifier}} + virtual ~S(); + constexpr void foo() { typeid((S &&)*nullptr); } // both-error {{indirection requires pointer operand}} \ + // both-warning {{expression with side effects will be evaluated despite being used as an operand to 'typeid'}} \ + // both-warning {{expression result unused}} +}; +}; // namespace std `````````` </details> https://github.com/llvm/llvm-project/pull/242231 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
