Код: Выделить всё
#include
class A;
void f( const std::vector & = {} );
она работает нормально в GCC, и в Clang 14, но начиная с Clang 15 появляется ошибка: < /p>
Код: Выделить всё
In file included from :1:
/opt/compiler-explorer/clang-15.0.0/bin/../include/c++/v1/vector:540:52: error: arithmetic on a pointer to an incomplete type 'A'
{return static_cast(__end_cap() - this->__begin_);}
~~~~~~~~~~~ ^
/opt/compiler-explorer/clang-15.0.0/bin/../include/c++/v1/vector:760:56: note: in instantiation of member function 'std::vector::capacity' requested here
__annotate_contiguous_container(data(), data() + capacity(),
^
/opt/compiler-explorer/clang-15.0.0/bin/../include/c++/v1/vector:431:7: note: in instantiation of member function 'std::vector::__annotate_delete' requested here
__annotate_delete();
^
:5:32: note: in instantiation of member function 'std::vector::~vector' requested here
void f( const std::vector & = {} );
^
:3:7: note: forward declaration of 'A'
class A;
^
Правильны ли более новые версии Clang в отвержении программы?
Подробнее здесь: https://stackoverflow.com/questions/773 ... with-a-def
Мобильная версия