Reputation: 42225
Why can constexpr not apply to constructors?
The following code cannot be compiled with VC++ 2013 CTP.
struct A
{
constexpr A()
: _n(5)
{}
int _n;
};
constexpr A f()
{
return A();
}
int main()
{
auto a = f();
}
error C3757: 'A': type not allowed for 'constexpr' function
Upvotes: 0
Views: 352