[all-commits] [llvm/llvm-project] 59b093: [Clang] Treat address-of template substitution as ...
Yaxun (Sam) Liu via All-commits
all-commits at lists.llvm.org
Fri Jul 10 11:34:51 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 59b0935b1494c90e02cc95a625f168f606966c3d
https://github.com/llvm/llvm-project/commit/59b0935b1494c90e02cc95a625f168f606966c3d
Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
Date: 2026-07-10 (Fri, 10 Jul 2026)
Changed paths:
M clang/docs/ReleaseNotes.md
M clang/lib/Sema/SemaTemplateDeduction.cpp
M clang/test/SemaTemplate/overload-candidates.cpp
Log Message:
-----------
[Clang] Treat address-of template substitution as SFINAE
Taking the address of a function template specialization can instantiate
its trailing return type as part of a SFINAE probe:
struct X {};
template <class T> void f(T) = delete;
template <class T> auto probe(T t) -> decltype(f(t), void());
template <class T, class = decltype(&probe<T>)> int test(int);
template <class T> char test(...);
static_assert(sizeof(test<X>(0)) == sizeof(char));
Here, substituting the return type of probe<X> selects the deleted f<X>.
The deleted call is in the immediate context of substitution, so it should
remove test(int) from overload resolution. GCC accepts this example. Clang
instead kept deduction as successful and later replayed the stored
diagnostic as a hard error.
The call-deduction path already checks the SFINAE trap after finishing
template argument deduction. Do the same for the address-of path, so the
stored diagnostic is not replayed after deduction succeeds.
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