Определение вне класса с требованием CLAUE отклоняется Clang, но работает с GCCC++

Программы на C++. Форум разработчиков
Anonymous
Определение вне класса с требованием CLAUE отклоняется Clang, но работает с GCC

Сообщение Anonymous »

Clang в настоящее время отклоняет следующий код: < /p>

Код: Выделить всё

template 
constexpr bool is_valid = true;

template
class Nesting
{
public:
template requires is_valid
class Inner;
};

template
template requires is_valid
class Nesting::Inner
{
public:
static inline void Do();
};

#include 

template
template requires is_valid
inline void Nesting::Inner::Do()
{
std::cout 
с < /p>
:14:31: error: requires clause differs in template redeclaration
14 | template requires is_valid
|                               ^
:8:35: note: previous template declaration is here
8 |     template requires is_valid
|                                   ^
:25:35: error: out-of-line definition of 'Do' from class 'Inner' without definition
25 | inline void Nesting::Inner::Do()
|             ~~~~~~~~~~~~~~~~~~~~~~^
:31:19: error: implicit instantiation of undefined template 'Nesting::Inner'
31 |     Nesting::Inner::Do();
|                   ^
:9:11: note: template is declared here
9 |     class Inner;
Что не так с моим кодом - это ошибка Clang?


Подробнее здесь: https://stackoverflow.com/questions/796 ... works-with

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