http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55861
Bug #: 55861
Summary: [C++11] `std::shared_future::get' is not
const-qualified
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: [email protected]
ReportedBy: [email protected]
`std::shared_future<R>::get' member function is specified as const-qualified in
[futures.shared_future]. However, libstdc++'s implementation is not. A testcase
would be as follows;
//--------------------------------------------------
#include <future>
int f()
{
return 42;
}
int main()
{
std::shared_future<int> const ftr(std::async(&f));
ftr.get(); // Line 11
}
//--------------------------------------------------
For the above testcase, GCC 4.8.0 20121230 complains as follows;
main.cpp: In function 'int main()':
main.cpp:11:11: error: passing 'const std::shared_future<int>' as 'this'
argument of 'const _Res& std::shared_future<_Res>::get() [with _Res = int]'
discards qualifiers [-fpermissive]
ftr.get();
^