[PATCH] D18510: [cxx1z-constexpr-lambda] Make conversion function constexpr

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 14 17:08:37 PDT 2016


rsmith added a comment.

I don't see how this approach can work; the fact that we happened to ask the expression evaluator to evaluate an expression is not sufficient reason for us to issue this warning. For instance:

  auto a = []{};
  void (*p)() = a;

... will ask the evaluator to evaluate the initializer of `p`, which it appears will now generate a bogus extension warning in C++11 and C++14 mode.

If you want to carry on down this path, I think you will need to do something similar to what we discussed at Oulu, but I expect getting a correct warning to be complex and difficult, so I think the best approach would be to give up on this compat warning / extension, and instead only turn on the `constexpr` flag in C++17 mode. We could burn a lot of time getting this compatibility warning / extwarn to work, and it seems better to make progress on the rest of the constexpr lambdas feature instead :)


https://reviews.llvm.org/D18510





More information about the cfe-commits mailing list