[all-commits] [llvm/llvm-project] fe0116: [clang] Fix a crash when casting to an array type

Alan Zhao via All-commits all-commits at lists.llvm.org
Tue Jul 18 09:48:32 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fe0116aba833ee8597e2155d1e555c326acfaafc
      https://github.com/llvm/llvm-project/commit/fe0116aba833ee8597e2155d1e555c326acfaafc
  Author: Alan Zhao <ayzhao at google.com>
  Date:   2023-07-18 (Tue, 18 Jul 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaCast.cpp
    M clang/test/SemaCXX/paren-list-agg-init.cpp

  Log Message:
  -----------
  [clang] Fix a crash when casting to an array type

In C++20, if Clang fails to perform constructor overload on a
RecordType, then Clang will try to perform parentesized aggregate
initialization. If that fails and the initialization was attempted as
part of a cast, then we should get the diagnostics from the failed
constructor overload attempt. However, we don't attempt constructor
overloading for arrays, so previously, if we try to diagnose an
overloaded cast for a parenthesized aggregate initialization of an
array, we crash. To fix this, we now exit tryDiagnoseOverloadedCast(...)
for failed parentesized list initialization if the destination type is
an array.

Fixes #63758

Reviewed By: aaron.ballman

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




More information about the All-commits mailing list