So in the latest Visual Studio 2015 the following code seems to no longer work:
template<class F>
struct wrapper
{
constexpr wrapper()
{}
};
template<typename T>
constexpr typename std::remove_reference<T>::type *addr(T&& t)
{
return &t;
}
template<class F>
constexpr wrapper<F> wrap(F*)
{
return wrapper<F>();
}
const constexpr auto add_one = wrap(true ? nullptr : addr([](int x)
{
return x + 1;
}));
Visual Studio reports back illegal initialization of 'constexpr' entity with a non-constant expression
. This used to work in the release candidate, but the latest build seems to no longer work(I am using version 14.0.23107.0
). This should work(it does work in both clang and gcc).
Unfortunately, Microsoft doesn't let me report bugs. So does anyone know of a workaround?
Aucun commentaire:
Enregistrer un commentaire