[clang] [-Wunsafe-buffer-usage] Ignore consteval functions (PR #171503)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 10 17:10:29 PST 2025


================
@@ -4458,6 +4458,11 @@ void clang::checkUnsafeBufferUsage(const Decl *D,
   SmallVector<Stmt *> Stmts;
 
   if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
+    // Consteval functions are free of UB by the spec, so we don't need to
+    // visit them or produce diagnostics.
+    if (FD->isConsteval()) {
----------------
mxms0 wrote:

Fixed :)

https://github.com/llvm/llvm-project/pull/171503


More information about the cfe-commits mailing list