http://llvm.org/bugs/show_bug.cgi?id=14419

             Bug #: 14419
           Summary: Possible misbehavior with multiple variadic template
                    parameter packs
           Product: clang
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


I believe that clang++ either handles the following situation incorrectly or,
at the very least, requires improvements on its analysis of the situation and
subsequent error messages. (I have to admit, however, that I do not know how
the C++11 standard specifies how this should be handled.) Consider the
following function definition:

    template<typename... Pack1, typename... Pack2>
    void func(Pack1... pack1, Pack2... pack2) {}

If the above function is called without parameters, as in "func();", clang++
issues the following error:

  No matching function for call to 'func'
  Candidate function template not viable: requires at least 1 argument, but 0
were provided

However, if it's called with eg. one parameter, like "func(5);", it issues the
(rather contradictory) error:

  No matching function for call to 'func'
  Candidate function not viable: requires 0 arguments, but 1 was provided

(A notable difference is that the first error mentions the function being a
template, while the second does not.)

Note that calling it like "foo<int>(5);" does compile and work ok. (All
parameters given to the function are passed as the 'pack1' parameter.)

Also note that in gcc the function call compiles ok without having to specify
the template parameter types. (Curiously in gcc all parameters are passed as
the 'pack2' parameter. I'm guessing the standard leaves it open to the
implementation.)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to