Qualcuno può provare a spiegarlo?Strange comportamento di constexpr per la classe interna
template<typename T, size_t S = T::noElems()>
struct C
{
};
struct X
{
enum E { A, B, C };
static constexpr size_t noElems() { return C+1; };
};
struct K
{
C<X> cx; // this DOES compile
};
struct Y
{
struct Z
{
enum E { A, B, C };
static constexpr size_t noElems() { return C+1; };
};
C<Z, Z::C+1> cyz; // this DOES compile
C<Z> cyz; // <--- this does NOT compile
};
Clang lamenta la funzione non definita 'noElems' non può essere utilizzata in un'espressione costante' –
Penso che si possa rispondere [qui] (http://stackoverflow.com/a/8108406/4035785) –
Puoi aggiungere la compilation errore nella tua domanda? – Angew