Почему я получаю здесь ошибку неполного типа?C++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Anonymous
 Почему я получаю здесь ошибку неполного типа?

Сообщение Anonymous »

Мне интересно, может ли кто-нибудь помочь мне понять это предупреждение компилятора?
notifier.hpp

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

#ifndef HAL_NOTIFIER_HPP
#define HAL_NOTIFIER_HPP

#include 
#include 

#include 

#include "notification_id.hpp"
#include "notify_handle_fwd.hpp"

namespace hal
{

class notifier : private boost::noncopyable
{
public:
virtual ~notifier() = default;

virtual void register_handler(
notification_id id, const std::shared_ptr& handler) = 0;

virtual void notify(notification_id id) const = 0;

virtual void notify(notification_id id, const std::any& data) const = 0;
};

}

#endif
notifier_mock.hpp

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

#ifndef HAL_NOTIFIER_MOCK_HPP
#define HAL_NOTIFIER_MOCK_HPP

#include 

#include 

namespace hal
{

class notifier_mock : public notifier
{
public:
MOCK_METHOD(
void,
register_handler,
(
notification_id id,
const std::shared_ptr& handler
),
(override));

MOCK_METHOD(void, notify, (notification_id id), (const, override));

MOCK_METHOD(
void,
notify,
(notification_id id, const std::any& data),
(const, override));
};

}

#endif
Я получаю следующую ошибку:

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

[build] orangepi_zero3_sysroot/lib/gcc/aarch64-linux-gnu/12/../../../../include/c++/12/type_traits:1003:14: error: base class has incomplete type
[build]  1003 |     : public __is_constructible_impl
[build]       |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] orangepi_zero3_sysroot/lib/gcc/aarch64-linux-gnu/12/../../../../include/c++/12/type_traits:1010:14: note: in instantiation of template class 'std::__is_copy_constructible_impl' requested here
[build]  1010 |     : public __is_copy_constructible_impl
[build]       |              ^
[build] orangepi_zero3_sysroot/lib/gcc/aarch64-linux-gnu/12/../../../../include/c++/12/type_traits:3205:5: note: in instantiation of template class 'std::is_copy_constructible' requested here
[build]  3205 |     is_copy_constructible::value;
[build]       |     ^
[build] orangepi_zero3_sysroot/lib/gcc/aarch64-linux-gnu/12/../../../../include/c++/12/any:188:20: note: in instantiation of variable template specialization 'std::is_copy_constructible_v' requested here
[build]   188 |               enable_if_t
[build]       |                                                            ^
[build] orangepi_zero3_sysroot/lib/gcc/aarch64-linux-gnu/12/../../../../include/c++/12/tuple:1095:2: note: while substituting prior template arguments into non-type template parameter [with _U1 = testing::Matcher, _U2 = testing::Matcher]
[build]  1095 |         tuple(const tuple& __in)
[build]       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build]  1096 |         noexcept(__nothrow_constructible())
[build]       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build]  1097 |         : _Inherited(static_cast(__in)) { }
[build]       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] orangepi_zero3_sysroot/lib/gcc/aarch64-linux-gnu/12/../../../../include/c++/12/tuple:981:11: note: while substituting deduced template arguments into function template 'tuple' [with _U1 = testing::Matcher, _U2 = testing::Matcher, $2 = (no value)]
[build]   981 |     class tuple : public _Tuple_impl
[build]       |           ^
[build] /Users/usr/.conan/data/gtest/1.15.0/_/_/package/3ea503d9480b6fa55c88f393c25d3db9ad78ebd5/include/gmock/gmock-spec-builders.h:1282:7: note: while declaring the implicit copy constructor for 'MockSpec'
[build]  1282 | class MockSpec {
[build]       |       ^
[build] /Users/usr/Documents/Development/C++ Workspace/Code/project/test/flutter/hal/notifier_mock.hpp:27:5: note: in instantiation of template class 'testing::internal::MockSpec' requested here
[build]    27 |     MOCK_METHOD(
[build]       |     ^
[build] /Users/usr/.conan/data/gtest/1.15.0/_/_/package/3ea503d9480b6fa55c88f393c25d3db9ad78ebd5/include/gmock/gmock-function-mocker.h:115:3: note: expanded from macro 'MOCK_METHOD'
[build]   115 |   GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__) \
[build]       |   ^
[build] /Users/usr/.conan/data/gtest/1.15.0/_/_/package/3ea503d9480b6fa55c88f393c25d3db9ad78ebd5/include/gmock/internal/gmock-pp.h:49:7: note: expanded from macro 'GMOCK_PP_VARIADIC_CALL'
[build]    49 |       GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__))
[build]       |       ^
[build] /Users/usr/.conan/data/gtest/1.15.0/_/_/package/3ea503d9480b6fa55c88f393c25d3db9ad78ebd5/include/gmock/internal/gmock-pp.h:5:30: note: expanded from macro 'GMOCK_PP_CAT'
[build]     5 | #define GMOCK_PP_CAT(_1, _2) GMOCK_PP_INTERNAL_CAT(_1, _2)
[build]       |                              ^
[build] note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
[build] /Users/usr/.conan/data/gtest/1.15.0/_/_/package/3ea503d9480b6fa55c88f393c25d3db9ad78ebd5/include/gmock/gmock-function-mocker.h:133:3: note: expanded from macro 'GMOCK_INTERNAL_MOCK_METHOD_ARG_4'
[build]   133 |   GMOCK_INTERNAL_MOCK_METHOD_IMPL(                                         \
[build]       |   ^
[build] /Users/usr/.conan/data/gtest/1.15.0/_/_/package/3ea503d9480b6fa55c88f393c25d3db9ad78ebd5/include/gmock/gmock-function-mocker.h:192:59: note: expanded from macro 'GMOCK_INTERNAL_MOCK_METHOD_IMPL'
[build]   192 |   ::testing::MockSpec gmock_##_MethodName( \
[build]       |                                                           ^
[build] :75:1: note: expanded from here
[build]    75 | gmock_notify
[build]       | ^
[build] orangepi_zero3_sysroot/lib/gcc/aarch64-linux-gnu/12/../../../../include/c++/12/type_traits:970:12: note: definition of 'std::__is_constructible_impl' is not complete until the closing '}'
[build]   970 |     struct __is_constructible_impl
[build]       |            ^
[build] 1 error generated.
[build] make[3]: *** [test/unit/flutter/hal/location/CMakeFiles/unit_flutter_hal_location_tests.dir/gps_impl_tests.cpp.o] Error 1
[build] make[2]: *** [test/unit/flutter/hal/location/CMakeFiles/unit_flutter_hal_location_tests.dir/all] Error 2
[build] make[1]: *** [test/unit/flutter/hal/location/CMakeFiles/unit_flutter_hal_location_tests.dir/rule] Error
Интересно то, что это отлично компилируется с apple clang.
Это не удается при использовании LLVM clang при кросс-компиляции в aarch64 с использованием системного корня, содержащего gcc12.
Не могу понять, в чем проблема. Это кажется чем-то похожим: https://github.com/nlohmann/json/issues/2129

Подробнее здесь: https://stackoverflow.com/questions/791 ... error-here
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

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