Why does a default argument for a lambda argument trigger a -pedantic" GCC warning?

前端 未结 3 1868
臣服心动
臣服心动 2021-02-07 05:37

I had this lambda somewhere in my code:

[](bool a, bool=true){ return !a;} }

and GCC 4.6 \"complained\" with this warning:

warn         


        
3条回答
  •  温柔的废话
    2021-02-07 05:54

    Since C++14 it is allowed. It was found to be a defect long time ago: Default arguments for lambdas, and also Default arguments in lambda-expressions.

提交回复
热议问题