[all-commits] [llvm/llvm-project] e0eb7c: [Clang] Ensure initialized NTTP expressions when b...

Younan Zhang via All-commits all-commits at lists.llvm.org
Thu Oct 2 23:17:36 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e0eb7c25cbb5b5b80f023b1e3cc0b31e1bdaa8f0
      https://github.com/llvm/llvm-project/commit/e0eb7c25cbb5b5b80f023b1e3cc0b31e1bdaa8f0
  Author: Younan Zhang <zyn7109 at gmail.com>
  Date:   2025-10-03 (Fri, 03 Oct 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaInit.cpp
    M clang/lib/Sema/SemaTemplateDeductionGuide.cpp
    M clang/test/SemaCXX/cxx20-ctad-type-alias.cpp

  Log Message:
  -----------
  [Clang] Ensure initialized NTTP expressions when building CTAD for type aliases (#161035)

We missed calling CheckTemplateArgument when building CTAD deduction
guides. That ensures some InitExprs are correctly initialized, as in the
test that crashed due to incorrect NTTP initialization.

I don't use CheckTemplateArguments because, in CTAD synthesis, template
parameter packs don't always appear at the end of the parameter list,
unlike user-written ones mandated by the standard. This makes it
difficult for CheckTemplateArguments to determine how many arguments a
pack in middle should match, leading to unnecessary complexity.

On the other hand, since we substitute non-deduced template parameters
with deduced ones, we need to fold the packs midway through
substitution, where CheckTemplateArgument is more convenient.

As a drive-by this also removes some dead code in SemaInit.

Fixes #131408



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