[clang] [clang][bytecode] Fix crash in void functions returning non-void expr… (PR #176550)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 17 23:40:13 PST 2026


================
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify %s
+
+constexpr void foo(int n) {
+  return n > 1 ? foo(n - 1) : 0; // expected-error {{return type 'void' must match the return type 'int' of the expression}}
+}
+static_assert((foo(2), true), "");
----------------
tbaederr wrote:

Add this to an existing test case, where it will also be tested with the current interpreter.

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


More information about the cfe-commits mailing list