[llvm-bugs] [Bug 25695] New: unable to pass types from vairadic-template-function to templated argument(s)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 1 11:45:22 PST 2015


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

            Bug ID: 25695
           Summary: unable to pass types from vairadic-template-function
                    to templated argument(s)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at adaptivetime.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

if you have a variadic template type (see type "deeper") and pass it as a
template argument to s variadic template function (see function "shallow") then
clang will be unable to use it, even without having to deduce it's type.

=== CODE ===

template<typename... ArgTypes>
using deeper = void(*)(ArgTypes...);

template<typename... ArgTypes>
void shallow(deeper<ArgTypes...> arg) { }

int main(int argc, char* argv[])
{
  deeper<int> arg;
  shallow<int>(arg);
  return 0;
}


=== ERRORS ===

$ clang++ -std=c++14 broken.cpp -o broke
broken.cpp:10:3: error: no matching function for call to 'shallow'
  shallow<int>(arg);
  ^~~~~~~~~~~~
broken.cpp:5:6: note: candidate template ignored: failed template argument
deduction          
void shallow(deeper<ArgTypes...> arg) { }
     ^
1 error generated.

-- 
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/20151201/e868bcae/attachment.html>


More information about the llvm-bugs mailing list