mc-imperial / dredd

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

Dredd failed to rewrite sizes of constant-sized arrays with `constexpr` qualifier #283

Closed JonathanFoo0523 closed 1 month ago

JonathanFoo0523 commented 1 month ago

Applying dredd to

int main() {
  const int a = 4;
  static constexpr char b[a]{};
}

produce

int main() {
  const int a = __dredd_replace_expr_int_constant(4, 0);
  static constexpr char b[a]{};
}

which caused the error

error: variable length array declaration cannot have 'static' storage duration

This bug is similar in nature to issue #263 (addressed by PR #273 )

afd commented 1 month ago
void foo() {
  const int a = 4;
  constexpr char b[a]{};
}

After mutation this leads to:

error: constexpr variable cannot have non-literal type 'const char[a]'
void foo() {
  const int a = 4;
  static constexpr char b[a]{};
}

After mutation this leads to an error similar to the one above.