jeudi 13 janvier 2022

constexpr position in variable declaration

Usually I like to put "const" behind the type, as

int const foo1 = 123;

Now, if i want to declare a second variable (which should even be constexpr) I would like to use the same style:

int constexpr foo2 = 123;

However, this led to a warning upon running a code analysis tool (however, all compilers I tried accept it). Does the C++ standard mandate that constexpr can only be used before the actual type?

Aucun commentaire:

Enregistrer un commentaire