llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> Fixes https://github.com/llvm/llvm-project/issues/179020 --- Full diff: https://github.com/llvm/llvm-project/pull/179087.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Compiler.cpp (+2) - (modified) clang/test/AST/ByteCode/invalid.cpp (+5) ``````````diff diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index da1db48c55a07..af076f90733df 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -477,6 +477,8 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) { return this->delegate(SubExpr); case CK_BitCast: { + if (CE->containsErrors()) + return false; QualType CETy = CE->getType(); // Reject bitcasts to atomic types. if (CETy->isAtomicType()) { diff --git a/clang/test/AST/ByteCode/invalid.cpp b/clang/test/AST/ByteCode/invalid.cpp index f7f2da2769d65..bfb33d0cc6dce 100644 --- a/clang/test/AST/ByteCode/invalid.cpp +++ b/clang/test/AST/ByteCode/invalid.cpp @@ -132,3 +132,8 @@ namespace RetVoidInInvalidFunc { }; X<foo()> x; // both-error {{non-type template argument is not a constant expression}} } + +namespace BitCastWithErrors { + template<class T> int f(); // both-note {{candidate template ignored}} + static union { char *x = f(); }; // both-error {{no matching function for call to 'f'}} +} `````````` </details> https://github.com/llvm/llvm-project/pull/179087 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
