Ответ 1
С объявлением структуры
struct Y
{
struct Z
{
enum E { A, B, C };
static constexpr size_t noElems() { return C+1; };
};
C<Z, Z::C+1> cyz1; // this DOES compile
C<Z> cyz2; // <--- this does NOT compile
};
объекты cyz1
и cyz2
анализируются перед встроенным объявлением Z::noElems()
, поэтому определение
static constexpr size_t noElems() { return C+1; };
недоступен во время объявления
C<Z> cyz2;