Почему следующий код успешно компилируется с GCC и Clang в C++20, но не компилируется с MSVC в C++20? [дубликат]C++

Программы на C++. Форум разработчиков
Anonymous
Почему следующий код успешно компилируется с GCC и Clang в C++20, но не компилируется с MSVC в C++20? [дубликат]

Сообщение Anonymous »

Код прост. Вот ссылка: https://godbolt.org/z/xe49MxoMM
Ошибка отчета msvc:
(6): error C2039: 'VertexCount': is not a member of 'Derived'
(10): note: see declaration of 'Derived'
(6): note: the template instantiation context (the oldest one first) is
(10): note: see reference to class template instantiation 'Base' being compiled
(6): error C2065: 'VertexCount': undeclared identifier
(6): error C2131: expression did not evaluate to a constant
(6): note: a non-constant (sub-)expression was encountered
Compiler returned: 2

Изменить:
Вот код:
#include

template
class Base {
public:
static constexpr int VertexCount = T::VertexCount;
};

class Derived : public Base {
public:
static constexpr int VertexCount = 3;
};

int main() {
std::cout

Подробнее здесь: https://stackoverflow.com/questions/793 ... -in-c20-bu

Вернуться в «C++»