Skip to content

MSVC: error C4789: in function 'main' buffer '' of size 12 bytes will be overrun; 8 bytes will be written starting at offset 11 #2099

Description

@mika-fischer

Compiling the code below with latest MSVC (cl 19.51.36244) and the flags -std:c++20 -MD -O2 -Zc:__cplusplus -Zc:preprocessor -sdl gives the error:

include\stdexec\__detail\__basic_sender.hpp(443) : error C4789: in function 'main' buffer '' of size 12 bytes will be overrun; 8 bytes will be written starting at offset 11

It might be a false positive but I'm not sure and thought it might be worth reporting.

BTW: It's an error only because of -sdl and can be downgraded back to a warning with /w14789

#include <stdexec/execution.hpp>

using namespace stdexec;

auto main() -> int {
    auto work = just() | let_value([] { return just(); });
    sync_wait(just(uintptr_t{0})
              | let_value([unused_capture = 0, unused_capture2 = work](uintptr_t /*unused_value*/) { return just(); }));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions