Following code
compiles in GCC but does not compile in clang with the following error message
main.cpp:5:28: error: constexpr variable 'S' must be initialized by a constant expression constexpr size_t S = a.size(); ^~~~~~~~
Meanwhile, many reports of constexpr issues on SO seem to imply that clang often has better (more pedantic?) Support for constexpr . So, which compiler would be right in this case?
Please note that both compilers gladly accept the code after replacing the reference parameter with the pass-by-value parameter.
c ++ gcc language-lawyer clang constexpr
AnT
source share