[all-commits] [llvm/llvm-project] b36453: [Clang] Diagnose ill-formed constant expression wh...

Shafik Yaghmour via All-commits all-commits at lists.llvm.org
Thu Jul 28 15:28:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b3645353041818f61e2580635409ddb81ff5a272
      https://github.com/llvm/llvm-project/commit/b3645353041818f61e2580635409ddb81ff5a272
  Author: Shafik Yaghmour <shafik.yaghmour at intel.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/Basic/DiagnosticASTKinds.td
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/test/Analysis/cfg.cpp
    M clang/test/Sema/aarch64-sve-intrinsics/acle_sve_imm.cpp
    M clang/test/SemaCXX/constant-expression-cxx11.cpp
    M clang/test/SemaCXX/enum-scoped.cpp
    M clang/test/SemaTemplate/temp_arg_enum_printing.cpp
    M clang/www/cxx_dr_status.html
    M cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp

  Log Message:
  -----------
  [Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values

DR2338 clarified that it was undefined behavior to set the value outside the
range of the enumerations values for an enum without a fixed underlying type.

We should diagnose this with a constant expression context.

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




More information about the All-commits mailing list