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

            Bug ID: 61953
           Summary: [C++11] The template parameter pack of a function
                    template should be the last template parameter
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kariya_mitsuru at hotmail dot com

The both sample codes below should cause compilation error but they are
compiled successfully by gcc.

==============================================
template<class... T, class... U> void f() { }
==============================================

===========================================
template<class... T, class U> void g() { }
===========================================

According to C++11 standard 14.1 Template parameters [temp.param] paragraph 11,
"A template parameter pack of a function template shall not be followed by
another template parameter unless that template parameter can be deduced from
the parameter-type-list of the function template or has a default argument."

The latest draft is more clarified using the following example.

=======================================================================
// U can be neither deduced from the parameter-type-list nor specified
template<class... T, class... U> void f() { } // error
template<class... T, class U> void g() { } // error
=======================================================================

cf. http://melpon.org/wandbox/permlink/zO14UQDvxpXwRfYm

Reply via email to