[all-commits] [llvm/llvm-project] 8210ac: [clang] disallow narrowing when matching template ...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Sat Jan 25 19:56:35 PST 2025


  Branch: refs/heads/users/mizvekov/clang-cwg2398-nttp-narrowing
  Home:   https://github.com/llvm/llvm-project
  Commit: 8210ac8a213a8409dc3b470fb295b70e8264934d
      https://github.com/llvm/llvm-project/commit/8210ac8a213a8409dc3b470fb295b70e8264934d
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2025-01-26 (Sun, 26 Jan 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    M clang/test/CXX/drs/cwg0xx.cpp
    M clang/test/CXX/drs/cwg12xx.cpp
    M clang/test/CXX/drs/cwg3xx.cpp
    M clang/test/CXX/expr/expr.const/p3-0x.cpp
    M clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
    M clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp
    M clang/test/Modules/cxx-templates.cpp
    M clang/test/SemaObjCXX/noescape.mm
    M clang/test/SemaTemplate/cwg2398.cpp
    M clang/test/SemaTemplate/default-arguments.cpp
    M clang/test/SemaTemplate/instantiate-template-template-parm.cpp
    M clang/test/SemaTemplate/instantiation-default-2.cpp
    M clang/test/SemaTemplate/nested-template.cpp
    M clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
    M clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
    M clang/test/SemaTemplate/temp_arg_template.cpp
    M clang/test/SemaTemplate/temp_arg_template_p0522.cpp

  Log Message:
  -----------
  [clang] disallow narrowing when matching template template parameters

This fixes the core issue described in P3579, following the design
intent of P0522 to not introduce any new cases where a template
template parameter match is allowed for a template which is not valid
for all possible uses.

With this patch, narrowing conversions is disallowed for TTP matching.

This reuses the existing machinery for diagnosing narrowing in
a converted constant expression.
Since P0522 is a DR and we apply it all the way back to C++98,
this brings that machinery to use in older standards, in this
very narrow scope of TTP matching.

This still doesn't solve the ambiguity when partial ordering NTTPs of
different integral types, this is blocked by a different bug which will
be fixed in a subsequent patch.



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