facebookexperimental / facebookexperimental/libunifex

Combination of submit and let_with causes compilation errors on MSVC

Open
#218 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

I suppose that this is a compiler bug, but just in case:

```
struct dummy_receiver {
void set_value() && noexcept {}
void set_error(std::exception_ptr) && noexcept {}
void set_done() && noexcept {}
};
...
submit(
let_with(
[]() noexcept { return 1; },
[&](auto &) {
return when_all(
transform(schedule(inline_scheduler()), [=]() noexcept {})
);
}),
dummy_receiver{}
);
```
This code won't compile on MSVC unless I remove the trailing return type [here](https://github.com/facebookexperimental/libunifex/blob/2efda8062a4ced795bfbe0ffb670904be2baffbd/include/unifex/when_all.hpp#L313), but in this case it will leak a memory (not de-allocating _submit::operation)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.