mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 11:16:09 +00:00

Even if we don't actually use the value of the second argument, we have to evaluate it for side-effects. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
35 lines
579 B
C++
35 lines
579 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
// expected-no-diagnostics
|
|
|
|
constexpr int test_clzg_0() {
|
|
int x = 0;
|
|
(void)__builtin_clzg(0U, ++x);
|
|
return x;
|
|
}
|
|
|
|
static_assert(test_clzg_0() == 1);
|
|
|
|
constexpr int test_clzg_1() {
|
|
int x = 0;
|
|
(void)__builtin_clzg(1U, ++x);
|
|
return x;
|
|
}
|
|
|
|
static_assert(test_clzg_1() == 1);
|
|
|
|
constexpr int test_ctzg_0() {
|
|
int x = 0;
|
|
(void)__builtin_ctzg(0U, ++x);
|
|
return x;
|
|
}
|
|
|
|
static_assert(test_ctzg_0() == 1);
|
|
|
|
constexpr int test_ctzg_1() {
|
|
int x = 0;
|
|
(void)__builtin_ctzg(1U, ++x);
|
|
return x;
|
|
}
|
|
|
|
static_assert(test_ctzg_1() == 1);
|