This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/52988] New: std::async not executed on function returning nullptr_t
- From: "surfintheusa at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 14 Apr 2012 16:19:02 +0000
- Subject: [Bug libstdc++/52988] New: std::async not executed on function returning nullptr_t
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52988
Bug #: 52988
Summary: std::async not executed on function returning
nullptr_t
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: surfintheusa@yahoo.com
Created attachment 27157
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27157
Sample code demonstrating bug and workaround.
Given a function which returns a nullptr_t, the following appears to not call
the function:
future<nullptr_t> fnp = async(returns_nullptr_t);
fnp.get();
For a function which returns an int, the behavior is as expected.
A workaround is to call fnp.wait() before fnp.get(). In that case, the function
is indeed called (and its side-effects are observed).
The attached file demonstrates the bug clearly. When executed, one should see
the output:
returns_nullptr_t
returns_int
but only the second line shows. If the workaround is applied, then both lines
show.