[all-commits] [llvm/llvm-project] 36f674: [AST] Stop evaluate constant expression if the con...

yronglin via All-commits all-commits at lists.llvm.org
Fri Jul 7 04:57:15 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 36f67434f724f2cdf36735b243fdaace726afb85
      https://github.com/llvm/llvm-project/commit/36f67434f724f2cdf36735b243fdaace726afb85
  Author: yronglin <yronglin777 at gmail.com>
  Date:   2023-07-07 (Fri, 07 Jul 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/SemaCXX/constexpr-function-recovery-crash.cpp

  Log Message:
  -----------
  [AST] Stop evaluate constant expression if the condition expression which in switch statement contains errors

This fix issue: https://github.com/llvm/llvm-project/issues/63453

```
constexpr int foo(unsigned char c) {
    switch (f) {
    case 0:
        return 7;
    default:
        break;
    }
    return 0;
}

static_assert(foo('d'));

```

Reviewed By: aaron.ballman, erichkeane, hokein

Differential Revision: https://reviews.llvm.org/D153296




More information about the All-commits mailing list