incomplete type for std::any when GMOCKing interface
问题 I have a very weird compilation problem with this snippet: #include <any> #include <gmock/gmock.h> struct Class { virtual std::any get(int, int) = 0; }; struct MockClass: Class { MOCK_METHOD2(get, std::any(int, int)); }; int foo() { MockClass dd; } Error gcc 9.1.0: /usr/include/c++/9.1.0/type_traits:131:12: error: incomplete type ‘std::is_copy_constructible<testing::internal::ReferenceOrValueWrapper<std::any> >’ used in nested name specifier clang 8.0.0: /usr/bin/../lib64/gcc/x86_64-pc-linux