constant-expression

Why are lambda expressions not allowed in an unevaluated operands but allowed in the unevaluated portions of constant expressions?

淺唱寂寞╮ 提交于 2019-11-26 11:21:48
问题 If we look at the draft C++ standard section 5.1.2 Lambda expressions paragraph 2 says ( emphasis mine going forward ): The evaluation of a lambda-expression results in a prvalue temporary (12.2). This temporary is called the closure object. A lambda-expression shall not appear in an unevaluated operand (Clause 5). [ Note: A closure object behaves like a function object (20.8).—end note ] and section 5.19 Constant expressions paragraph 2 says: A conditional-expression is a core constant