[all-commits] [llvm/llvm-project] 90fce4: Fix crash-on-invalid-code in lambda constant evalu...

James Y Knight via All-commits all-commits at lists.llvm.org
Wed Dec 4 12:12:21 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 90fce46fa6c9ccec86f642be0a75da2d0a5b11c1
      https://github.com/llvm/llvm-project/commit/90fce46fa6c9ccec86f642be0a75da2d0a5b11c1
  Author: James Y Knight <jyknight at google.com>
  Date:   2019-12-04 (Wed, 04 Dec 2019)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/SemaCXX/lambda-expressions.cpp

  Log Message:
  -----------
  Fix crash-on-invalid-code in lambda constant evaluation.

If the lambda used 'this' without without capturing it, an error was
emitted, but the constant evaluator would still attempt to lookup the
capture, and failing to find it, dereference a null pointer.

This only happens in C++17 (as that's when lambdas were made
potentially-constexpr). Therefore, I also updated the
lambda-expressions.cpp test to run in both C++14 and C++17 modes.




More information about the All-commits mailing list