FS#27751 - g++ error: ‘sleep_for’ is not a member of ‘std::this_thread’

Attached to Project: Arch Linux
Opened by Łukasz Gromanowski (lgromanowski) - Wednesday, 28 December 2011, 17:14 GMT
Last edited by Allan McRae (Allan) - Wednesday, 28 December 2011, 21:41 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
When using g++ 4.6.2 (on x86_64) to compile following code:

---------------------------------

#include <thread>
#include <chrono>

int main() {
std::this_thread::sleep_for(std::chrono::seconds(1));
return 0;
}

---------------------------------

there is a strange error:
./main.cpp:5:3: error: ‘sleep_for’ is not a member of ‘std::this_thread’

Additional info:
core/gcc 4.6.2-3:

g++ --version
g++ (GCC) 4.6.2 20111125 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Steps to reproduce:

Compile above code using this command:

g++ -std=c++0x -lpthread ./main.cpp

Workaround:
Add -D_GLIBCXX_USE_NANOSLEEP to g++ parameters.
This task depends upon

Closed by  Allan McRae (Allan)
Wednesday, 28 December 2011, 21:41 GMT
Reason for closing:  Upstream
Comment by Allan McRae (Allan) - Wednesday, 28 December 2011, 21:41 GMT
This is as intended upstream... experimental features and all...

Loading...