Misleading compile error for start_detached when not included
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.4k
- Forks
- 270
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 39
Description
I am not sure if this is an issue that should be fixed
For the following code, im not including <exec/start_detached.hpp> for calling exec::start_detached:
#include <stdexec/execution.hpp>
// missing include file
// #include <exec/start_detached.hpp>
void do_some_work() {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
int main() {
auto work = stdexec::just() | stdexec::then([] {
do_some_work();
});
exec::start_detached(std::move(work));
std::this_thread::sleep_for(std::chrono::seconds(1));
return 0;
}
and the compiler gives error:
-> % g++ ./include-issue.cpp -I/some/random/path/stdexec/include -std=c++20 -ltbb
./include-issue.cpp: In function ‘int main()’:
./include-issue.cpp:14:25: error: no match for call to ‘(const experimental::execution::start_detached_t) (std::remove_reference<stdexec::{anonymous}::__sexpr<<lambda closure object>stdexec::<lambda()>()>&>::type)’
14 | exec::start_detached(std::move(work));
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
- it's a bit misleading the compiler reporting "no match call" instead of "not defined", there might be a forward declarations seen by compiler
- given that im only including files under
stdexec, seeing forward declarations fromexecmight not be an expected behavior?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the diagnostic with include-issue.cpp using g++ in C++20 mode and the shown stdexec/execution.hpp include. Compare the declarations exposed by stdexec/execution.hpp with exec/start_detached.hpp and determine whether the reported error or header visibility is unintended; done means the expected include behavior and diagnostic are covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100