programming-with-cpp20 icon indicating copy to clipboard operation
programming-with-cpp20 copied to clipboard

02.25-coroutineParsingDataStreamCustomAllocator1 compile error with Ubuntu-GCC 12.1

Open 19317362 opened this issue 1 year ago • 1 comments

The error message is hard to understand. It seems like type-cast related. main.cpp:284:1: error: ‘static void promise_type_base<T, G, InitialSuspend>::operator delete(void*, size_t) [with T = std::__cxx11::basic_string<char>; G = generator<std::__cxx11::basic_string<char>, false>; bool InitialSuspend = false]’ called on pointer returned from a mismatched allocation function [-Werror=mismatched-new-delete] 284 | } | ^ 02.25-coroutineParsingDataStreamCustomAllocator1/main.cpp:284:1: note: returned from ‘static void* promise_type_base<T, G, InitialSuspend>::operator new(size_t, arena&, TheRest&& ...) [with TheRest = {DataStreamReader&}; T = std::__cxx11::basic_string<char>; G = generator<std::__cxx11::basic_string<char>, false>; bool InitialSuspend = false]’ /home/wps/cpp20/coro-study/02.25-coroutineParsingDataStreamCustomAllocator1/main.cpp: In function ‘generator<std::byte> sender(arena&, std::vector<std::byte>)’: 02.25-coroutineParsingDataStreamCustomAllocator1/main.cpp:292:1: error: ‘static void promise_type_base<T, G, InitialSuspend>::operator delete(void*, size_t) [with T = std::byte; G = generator<std::byte>; bool InitialSuspend = true]’ called on pointer returned from a mismatched allocation function [-Werror=mismatched-new-delete] 292 | } | ^ 02.25-coroutineParsingDataStreamCustomAllocator1/main.cpp:292:1: note: returned from ‘static void* promise_type_base<T, G, InitialSuspend>::operator new(size_t, arena&, TheRest&& ...) [with TheRest = {std::vector<std::byte, std::allocator<std::byte> >&}; T = std::byte; G = generator<std::byte>; bool InitialSuspend = true]’ cc1plus: all warnings being treated as errors

19317362 avatar Nov 28 '22 08:11 19317362