https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83417

David Friberg <davveston at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davveston at gmail dot com

--- Comment #3 from David Friberg <davveston at gmail dot com> ---
The same holds for the case of function pointers.

Given the following function:

 void f(int) {}

Both examples (A) and (B) below are well-formed, as per [temp.deduct.type]/13
(and for (B): also as per [temp.arg.nontype]/1).

 // Example (A)
 template <auto>
 struct A;

 template <typename T, void (*fp)(T)>
 struct A<fp> { };

 A<f> a{};  // #1: OK

 // Example (B)
 template <auto>
 struct B;

 template <typename T, auto (*fp)(T)>
 struct B<fp> { };

 B<f> b{};  // #2: Rejected (type deduction failure in partial specialization)

Clang accepts both, whereas GCC (trunk/any version I've tried that supports
C++17) rejects example (B), as #2 is resolved to the primary (non-defined)
class template after failing to deduce the dependent 'T' from 'auto (*fp)(T)'
in the partial specialization, given the argument 'f' to the latter (non-type)
template parameter.

Reply via email to