http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52988
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |jason at gcc dot gnu.org Component|libstdc++ |c++ Known to fail| |4.6.3, 4.8.0 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-14 17:29:52 UTC --- Jason, could ou take a look at this please? This looks like a G++ issue, doing something weird when nullptr_t is involved. Possibly assuming that since all nullptr_t values are the same there's no point calling a function to get one and it's valid to just return nullptr immediately. future<int>::get() produces this: _Res std::future<_Res>::get() [with _Res = int] (struct future * const this) { struct __basic_future * D.117159; int D.117160; struct __basic_future * D.117161; struct _Result & D.117162; int & D.117163; type & D.117164; struct _Reset __reset; try { D.117159 = &this->D.52581; std::__basic_future<int>::_Reset::_Reset (&__reset, D.117159); try { D.117161 = &this->D.52581; D.117162 = std::__basic_future<int>::_M_get_result (D.117161); D.117163 = std::__future_base::_Result<int>::_M_value (D.117162); D.117164 = std::move<int&> (D.117163); D.117160 = *D.117164; return D.117160; } finally { std::__basic_future<int>::_Reset::~_Reset (&__reset); } } finally { __reset = {CLOBBER}; } } But even though they're generated from the same template future<nullptr_t>::get() looks like this, with no call to _M_get_result() before returning: _Res std::future<_Res>::get() [with _Res = std::nullptr_t] (struct future * const this) { struct __basic_future * D.117150; <<< Unknown tree: nullptr_type >>> D.117151; struct _Reset __reset; try { D.117150 = &this->D.52293; std::__basic_future<std::nullptr_t>::_Reset::_Reset (&__reset, D.117150); try { D.117151 = 0; return D.117151; } finally { std::__basic_future<std::nullptr_t>::_Reset::~_Reset (&__reset); } } finally { __reset = {CLOBBER}; } }