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

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Tue Jan 28 10:51:39 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e29c085812e259910a3d8b6c2d2f471d1c3eede4
      https://github.com/llvm/llvm-project/commit/e29c085812e259910a3d8b6c2d2f471d1c3eede4
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2025-01-28 (Tue, 28 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 (#124313)

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 are 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 (but the test cases are added).



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