[all-commits] [llvm/llvm-project] 96bc78: [Clang] Update warning on some designator initiali...

Shafik Yaghmour via All-commits all-commits at lists.llvm.org
Mon May 8 11:16:36 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 96bc78631f16fe5ce2e7e6000b74d790b32f7a16
      https://github.com/llvm/llvm-project/commit/96bc78631f16fe5ce2e7e6000b74d790b32f7a16
  Author: Shafik Yaghmour <shafik.yaghmour at intel.com>
  Date:   2023-05-08 (Mon, 08 May 2023)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaInit.cpp
    M clang/test/SemaCXX/cxx2b-designated-initializers.cpp

  Log Message:
  -----------
  [Clang] Update warning on some designator initializer cases involving unions

Currently when using designated initializers in C++ we have a few
extension. Two extension which are dangerous involved assigning to
multiple members of union which will likely be a mistake since unions
can only have one active member. I have updated to be a warning by
default.

The second case if when we assign to multiple union members and one of
the previous members had a non-trivial destructor, which could lead to
leaking resources. This one is now an error by default.

Fixes: https://github.com/llvm/llvm-project/issues/62156

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




More information about the All-commits mailing list