Bug 96833 - Functors within target offload code
Summary: Functors within target offload code
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.3.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2020-08-28 09:25 UTC by Tobias Weinzierl
Modified: 2020-11-09 12:19 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Weinzierl 2020-08-28 09:25:48 UTC
I cannot declare a function

#pragma omp declare target
void foo( std::function<void()> x ) { 
...

even though x is, whenever I use it, declared as offloadable, too. The workaround is to make foo a template. It then works. Is this on purpose or a bug?
Comment 1 Jakub Jelinek 2020-08-28 16:06:42 UTC
Please read https://gcc.gnu.org/bugs.html, partial snippets aren't really useful, we need self-contained (if possible minimal) testcases that we can compile.
You also didn't say what the error was, so it is unclear if you got an error already from the host compilation, or only from the linking where it invokes the offloading compiler(s).  Neither you've started which offloading you have configured.
Comment 2 Tobias Weinzierl 2020-11-09 12:19:09 UTC
Likely bug in calling code: declare required in declaration and around definition