Skip to content

Conversation

@cmazakas
Copy link
Member

Fix a compilation failure when SBO-friendly Callables provide their own overloads for operator new.

When Callables are sufficiently small, they're emplaced into a small
buffer directly by placement new. If one, however, uses an unqualified
call to placement new, the class-based overloads are picked up and
compilation fails.

    libs/compat/test/move_only_function_test.cpp:107:11: note: candidate
    function not viable: requires 1 argument, but 2 were provided
        107 |     void* operator new(std::size_t) { throw 1234; }
To avoid class-based overload sets for operator new, we qualify our
calls to placement new with `::new` which forces us to pick up the
correct overload when emplacing objects in the small buffer.
@pdimov pdimov merged commit 349fb92 into boostorg:develop Jan 24, 2026
58 checks passed
@cmazakas cmazakas deleted the fix/placement-new branch January 24, 2026 13:32
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

Successfully merging this pull request may close these issues.

2 participants