Initializing a `static constexpr double` with MSVC 2013

て烟熏妆下的殇ゞ 提交于 2019-12-01 16:36:43

By the tables and explanation from Stephan T. L. in this blog, the constexpr is indeed only partially implemented in VS Nov 2013 CTP.

The CTP supports C++11 constexpr, except for member functions. (Another limitation is that arrays aren't supported.) Also, it doesn't support C++14's extended constexpr rules.

(wish to put it in comments, but no sufficient points yet)

Edit: Just to add, in Herb's blog, there is near same question about static members, but the reply is the same as Stephan.

I think it is safe to simple say that Nov 2013 CTP not implement the required OP feature (send a bug report?) and wait for a Jul 2014 CTP or VS Next (sadly).

You can't really "initialize" a constexpr. As the keyword implies, it's a constant expression, not a variable.

It seems you just want to use const here.

The compiler in the second example just points out that you can't make all types const-expr.

Update: This appears to be a MSVC limitation.

are happy to oblige.

Indeed, the C++11 support page mentions: no constexpr support in MSVC2010-2013

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!