As the title stated. The code is compiled using GNU c++2a
int main(){
(+[](){});
return 0;
}
Compiles fine.
However, the following code generates warning: value computed is not used [-Wunused-value]
int main(){
+[](){};
return 0;
}
Further question is: my understanding about the expression [](){}
is, it returns an r-value object std::function<void()>
. While, I don't know there is a unary operator +
, when the +
applies on any r-value, should it be a compile error generated? Or maybe because of the operator precedence, the expression is interpreted in another way?