Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

02.25-coroutineParsingDataStreamCustomAllocator1 compile error with Ubuntu-GCC 12.1 #2

Open
19317362 opened this issue Nov 28, 2022 · 1 comment

Comments

@19317362
Copy link

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

@andreasfertig
Copy link
Owner

Hello @19317362,

as far as I can see, this is the result of a new warning in GCC mismatched-new-delete. I wasn't able to quickly understand what this warning is complaining about and whether this isn't a false positive.

However, you can disable this warning -Wnomismatched-new-delete to get the code working. I hope this helps.

Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants