This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/52988] New: std::async not executed on function returning nullptr_t


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]