[LLVMbugs] [Bug 24098] New: Wrong number of template arguments with empty parameter pack

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jul 12 09:49:04 PDT 2015


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

            Bug ID: 24098
           Summary: Wrong number of template arguments with empty
                    parameter pack
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ldionne.2 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code fails to compile on Clang trunk:

    template <typename> struct f;

    template <typename ...Dummy, typename = f<int, Dummy...>>
    void foo() { }

The error is:

    prog.cc:3:53: error: wrong number of template arguments (2, should be 1)
     template <typename ...Dummy, typename = f<int, Dummy...>>
                                                         ^
    prog.cc:1:28: note: provided for 'template<class> struct f'
     template <typename> struct f;
                                ^

Strangely, the following compiles (swapped `Dummy...` and `int`):

    template <typename> struct f;

    template <typename ...Dummy, typename = f<Dummy..., int>>
    void foo() { }    


Live example: http://melpon.org/wandbox/permlink/yrtJAhiue1iDVLR3


Note that GCC rejects both examples. Naively, I think both should compile, 
but I haven't checked the standard. In all cases, either Clang has a bug,
GCC has a bug or both have a bug.

-- 
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/20150712/93277920/attachment.html>


More information about the llvm-bugs mailing list