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
  • 154,301
  • 39
  • 440
  • 740
atb
  • 1,412
  • 1
  • 14
  • 30

0 Answers0