Std :: thread Parameter type mismatch: expression must be rvalue

I have CLion 1.2 on Mint Maya with gcc5 installed. The default value of gcc is 4.6. (/ usr / bin / gcc β†’ gcc-4.6) The compiler is installed via CMakeLists and settings
[toolchain settings] https://www.dropbox.com/s/se5nxfdki7zdkhm/screen_settings_toolchain.png [sample] https://www.dropbox.com/s/ss7r6kss64k00ez/screen.png

The editor will say: parameter type mismatch: expression should be rvalue on std :: thread t1 (f1), but I can create and run this sample

What's wrong?

Example:

void f1(){ cout<<"hi"<<endl; } int main() { cout << "Hello, World!" << endl; std::thread t1(f1);//Parameter type mismatch: Expression must be rvalue t1.join(); return 0; } 
+5
source share
1 answer

I believe this is a Klion error parser

UPDATE

Affected Versions: CLion 1.2

Fix Version: CLion 2016.1

+5
source

Source: https://habr.com/ru/post/1243459/


All Articles