[all-commits] [llvm/llvm-project] 667d12: [Clang][Sema] Do not mark template parameters in t...

Krystian Stasiowski via All-commits all-commits at lists.llvm.org
Wed May 15 15:56:16 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 667d12f86e626173726e87e101626a9060b8d967
      https://github.com/llvm/llvm-project/commit/667d12f86e626173726e87e101626a9060b8d967
  Author: Krystian Stasiowski <sdkrystian at gmail.com>
  Date:   2024-05-15 (Wed, 15 May 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    A clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p3.cpp

  Log Message:
  -----------
  [Clang][Sema] Do not mark template parameters in the exception specification as used during partial ordering (#91534)

We do not deduce template arguments from the exception specification
when determining the primary template of a function template
specialization or when taking the address of a function template.
Therefore, this patch changes `isAtLeastAsSpecializedAs` such that we do
not mark template parameters in the exception specification as 'used'
during partial ordering (per [temp.deduct.partial]
p12) to prevent the following from being ambiguous:

```
template<typename T, typename U>
void f(U) noexcept(noexcept(T())); // #1

template<typename T>
void f(T*) noexcept; // #2

template<>
void f<int>(int*) noexcept; // currently ambiguous, selects #2 with this patch applied 
```

Although there is no corresponding wording in the standard (see core issue filed here
https://github.com/cplusplus/CWG/issues/537), this seems
to be the intended behavior given the definition of _deduction
substitution loci_ in [temp.deduct.general] p7 (and EDG does the same thing).



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