constexpr static data member without initializer
| Bugzilla Link | 35852 |
| Resolution | INVALID |
| Resolved on | Jun 01, 2018 07:08 |
| Version | trunk |
| OS | Windows XP |
Extended Description
#include
struct S
{
static std::complex
The compiler does not generate an error although an initializer is missing. As far as I know a constexpr static data member must have an initializer, even if it is of class type that has a constructor that can be called without arguments (as in this case). The correct code should initialize with a constructor, for instance:
struct S
{
static std::complex
As a side note: clang <= 3.8.1 and gcc (all versions) do not compile this code and report the missing initializer.
Now who's right and who's wrong?
In C++17 mode it seems clang is right and gcc is wrong: https://stackoverflow.com/questions/50638053/constexpr-static-data-member-without-initializer As a result I close this issue.