https://godbolt.org/z/5To7nKEP3
Код: Выделить всё
template
struct Bar {
int n = N;
constexpr Bar() {}
constexpr Bar(const Bar& b): n{b.n - 1} {}
};
template constexpr int get_n() { return b.n; }
constexpr auto b = Bar{};
static_assert(b.n == 1);
#ifdef _MSC_VER
static_assert(get_n() == 1);
#else
static_assert(get_n() == 0);
#endif
Что говорит стандарт?
Подробнее здесь: https://stackoverflow.com/questions/790 ... -that-spec