[all-commits] [llvm/llvm-project] d9b56d: [clang][constexpr] Move anonymous-union check befo...

Arendelle via All-commits all-commits at lists.llvm.org
Wed Jul 15 03:56:22 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9b56d3e5e012a618f55318662e3e5c9ba2c4abf
      https://github.com/llvm/llvm-project/commit/d9b56d3e5e012a618f55318662e3e5c9ba2c4abf
  Author: Arendelle <Arendelle_ at outlook.com>
  Date:   2026-07-15 (Wed, 15 Jul 2026)

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

  Log Message:
  -----------
  [clang][constexpr] Move anonymous-union check before getDestructor() in HandleDestructionImpl (#197416)

When HandleDestructionImpl destroys a class object during constant
evaluation, it attempts to look up the class's destructor via
getDestructor() before checking whether the record is an anonymous
union. Anonymous unions should not have their destructors invoked
directly during constant evaluation — their lifetime is managed by the
enclosing class's destructor. Move the anonymous-union short-circuit
before the getDestructor() call so anonymous unions are handled early,
regardless of whether getDestructor() returns null or not.

This fixes cases where an object with an implicitly-defined constexpr
destructor stored inside an anonymous union member was incorrectly
rejected during constant evaluation.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list