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

            Bug ID: 93107
           Summary: unable to deduce initializer_list<auto> from function
                    template
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Reduced from StackOverflow:

#include <initializer_list>

template<typename T>
void Task() {}

auto a = &Task<int>;
auto b = { &Task<int> };
std::initializer_list<void(*)()> c = { &Task<int> };
auto d = { static_cast<void(*)()>(&Task<int>) };

The declarations for 'a', 'c', and 'd' all compile. But the declaration for 'b'
is rejected with:

<source>:7:23: error: unable to deduce 'std::initializer_list<auto>' from '{(&
Task<int>)}'
    7 | auto b = { &Task<int> };
      |                       ^
<source>:7:23: note:   couldn't deduce template parameter 'auto'
Compiler returned: 1

All four compile on clang.

Reply via email to