mc-imperial / dredd

Framework for evaluating C/C++ compiler testing tools
Apache License 2.0
11 stars 3 forks source link

Dredd mutate constexpr inside if-condition #262

Closed JonathanFoo0523 closed 1 month ago

JonathanFoo0523 commented 1 month ago

When dredd is applied to the following file:

template <int a> void foo() {
  if constexpr (a) {};
}

int main() {
  foo<0>;
}

The constexpr is mutated:

template <int a> void foo() {
  if (!__dredd_enabled_mutation(3)) { if constexpr (__dredd_replace_expr_bool(a, 0)) {}; }
}

int main() {
  foo<0>;
}

This results in compilation error:

constexpr if condition is not a constant expression

I can't replicate the problem without the use of template.