[clang] [clang][ExprConst] Fix second arg of __builtin_{clzg,ctzg} not always being evaluated (PR #86742)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 19:26:14 PDT 2024


================
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+constexpr int increment(int& x) {
+  x++;
+  return x;
+}
+
+constexpr int test_clzg_0() {
+  int x = 0;
+  (void)__builtin_clzg(0U, increment(x));
----------------
overmighty wrote:

Random thought that popped up while in bed at 2 AM: I probably could have just used `++x` as second argument.

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


More information about the cfe-commits mailing list