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

            Bug ID: 96490
           Summary: Template code with function pointers fails with very
                    cryptic error message
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: khim at google dot com
  Target Milestone: ---

The following code works with all other compilers: https://godbolt.org/z/Mv3xsn

template<typename T, T p>
class TagType;

int foo();
constexpr auto foo_ptr = &foo;

template<typename T>
int test();

int bar() {
    return test<TagType<decltype(&foo), &foo>>();
}

int baz() {
    return test<TagType<decltype(foo_ptr), foo_ptr>>();

But GCC reports very cryptic error:

could not convert template argument 'foo_ptr' from 'int (* const)()' to 'int (*
const)()'

Reply via email to