https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/181327
None >From 4fdd02db1b4c338ca557e6e16ac9a6535ee255d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Fri, 13 Feb 2026 08:49:45 +0100 Subject: [PATCH] [clang][bytecode] Check for invalid call expressions --- clang/lib/AST/ByteCode/Compiler.cpp | 2 ++ clang/test/AST/ByteCode/invalid.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index dd10ad7d82653..2bb94f3ca2354 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -5272,6 +5272,8 @@ bool Compiler<Emitter>::VisitBuiltinCallExpr(const CallExpr *E, template <class Emitter> bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) { + if (E->containsErrors()) + return false; const FunctionDecl *FuncDecl = E->getDirectCallee(); if (FuncDecl) { diff --git a/clang/test/AST/ByteCode/invalid.cpp b/clang/test/AST/ByteCode/invalid.cpp index 497f193c5dd82..9f157db889a22 100644 --- a/clang/test/AST/ByteCode/invalid.cpp +++ b/clang/test/AST/ByteCode/invalid.cpp @@ -179,3 +179,12 @@ constexpr int invalidUnaryOrTypeTrait2() { /// Pointer::toRValue() of a function type. void foo() { *(void (*)()) ""; } // both-warning {{expression result unused}} +namespace InvalidCallExpr { + constexpr bool foo() { + struct A {}; + A a; + a.~A(__builtin_popcountg == 0, ""); // both-error {{builtin functions must be directly called}} + + return true; + } +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
