[all-commits] [llvm/llvm-project] bf9de4: Reject attempts to initialize non-aggregate types ...

Richard Smith via All-commits all-commits at lists.llvm.org
Thu Apr 6 18:01:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf9de4cf131032502c8967a65283a461fe36520d
      https://github.com/llvm/llvm-project/commit/bf9de4cf131032502c8967a65283a461fe36520d
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2023-04-06 (Thu, 06 Apr 2023)

  Changed paths:
    M clang/include/clang/AST/Expr.h
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Initialization.h
    M clang/lib/Sema/SemaInit.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/test/Sema/designated-initializers.c
    M clang/test/Sema/sizeless-1.c
    M clang/test/SemaCXX/cxx2a-initializer-aggregates.cpp
    M clang/test/SemaCXX/sizeless-1.cpp

  Log Message:
  -----------
  Reject attempts to initialize non-aggregate types from a designated
initializer list.

This previously led to some weird behaviors where we would unwrap the
initializer list expression and then try to use the DesignatedInitExprs
as constructor arguments.

Under the C++20 language rules, it's not valid to initialize a
reference-to-aggregate from a designated initializer list, but we have
historically accepted that, as do other compilers, and we continue to
accept that with this change. I've asked WG21 whether this should be
considered a wording defect.




More information about the All-commits mailing list