1

Given the following code:

constexpr float twoPi = std::atan (1.) * 8.;

clang generates the following error (see it live):

error: constexpr variable 'twoPi' must be initialized by a constant expression

but gcc does not (see it live).

Which compiler is correct?

Shafik Yaghmour
  • 148,593
  • 36
  • 425
  • 712
atb
  • 1,334
  • 1
  • 13
  • 28

0 Answers0