[all-commits] [llvm/llvm-project] 8de513: [Clang] Tighten restrictions on enum out of range ...

Shafik Yaghmour via All-commits all-commits at lists.llvm.org
Wed Aug 17 14:14:15 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8de51375f12d91675a18d17f262276e65f43fbe0
  Author: Shafik Yaghmour <shafik.yaghmour at intel.com>
  Date:   2022-08-17 (Wed, 17 Aug 2022)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/SemaCXX/constant-expression-cxx11.cpp
    M clang/test/SemaCXX/cxx2a-consteval.cpp

  Log Message:
  [Clang] Tighten restrictions on enum out of range diagnostic to avoid constant initialization

The restrictions added in D131704 were not sufficient to avoid all non-constant
expression contexts. In particular constant initialization cases.

We need to check EvaluatingDecl to detect if the variable we are initializing is
constexpr or not.

At this point it looks like this is the remaining case affecting various projects
with this diagnostic.

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

More information about the All-commits mailing list