Код прост. Вот ссылка: 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
Почему следующий код успешно компилируется с GCC и Clang в C++20, но не компилируется с MSVC в C++20? ⇐ C++
Программы на C++. Форум разработчиков
1736001705
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
Подробнее здесь: [url]https://stackoverflow.com/questions/79329010/why-does-the-following-code-compile-successfully-with-gcc-and-clang-in-c20-bu[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия