[llvm-bugs] [Bug 49079] New: Type mismatch for pointer to template template function

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 7 12:23:33 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49079

            Bug ID: 49079
           Summary: Type mismatch for pointer to template template
                    function
           Product: clang
           Version: 11.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pavel.kryukov at phystech.edu
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

If a function is a template template function (template<template<typename>
class> void foo(int&)), and a template template parameter has a default value,
it does not fit to function pointer type.

Example:

> template<typename, typename = int> class A { };
> 
> template<template<typename> class> void foo(int&);
> void bar(void(*)(int&));
> 
> int main()
> {
>     bar(foo<A>);
> }
Output:

> <source>:8:5: error: no matching function for call to 'bar'
>     bar(foo<A>);
>     ^~~
> <source>:4:6: note: candidate function not viable:
>   no overload of 'foo' matching 'void (*)(int &)' for 1st argument
> void bar(void(*)(int&));
Godbolt: https://godbolt.org/z/enhYs8

With GCC and MSVC, example compiles fine.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210207/501fa9ac/attachment.html>


More information about the llvm-bugs mailing list