public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61953] New: [C++11] The template parameter pack of a function template should be the last template parameter
@ 2014-07-29 16:23 kariya_mitsuru at hotmail dot com
  2014-12-14  0:42 ` [Bug c++/61953] " ville.voutilainen at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: kariya_mitsuru at hotmail dot com @ 2014-07-29 16:23 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/61953] [C++11] The template parameter pack of a function template should be the last template parameter
  2014-07-29 16:23 [Bug c++/61953] New: [C++11] The template parameter pack of a function template should be the last template parameter kariya_mitsuru at hotmail dot com
@ 2014-12-14  0:42 ` ville.voutilainen at gmail dot com
  2014-12-14  0:42 ` ville.voutilainen at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14  0:42 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |ville.voutilainen at gmail dot com
      Known to fail|                            |4.8.2, 4.9.1, 5.0

--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Clang also silently accepts the code.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/61953] [C++11] The template parameter pack of a function template should be the last template parameter
  2014-07-29 16:23 [Bug c++/61953] New: [C++11] The template parameter pack of a function template should be the last template parameter kariya_mitsuru at hotmail dot com
  2014-12-14  0:42 ` [Bug c++/61953] " ville.voutilainen at gmail dot com
@ 2014-12-14  0:42 ` ville.voutilainen at gmail dot com
  2021-08-04 20:48 ` pinskia at gcc dot gnu.org
  2021-08-12  1:17 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14  0:42 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-14
     Ever confirmed|0                           |1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/61953] [C++11] The template parameter pack of a function template should be the last template parameter
  2014-07-29 16:23 [Bug c++/61953] New: [C++11] The template parameter pack of a function template should be the last template parameter kariya_mitsuru at hotmail dot com
  2014-12-14  0:42 ` [Bug c++/61953] " ville.voutilainen at gmail dot com
  2014-12-14  0:42 ` ville.voutilainen at gmail dot com
@ 2021-08-04 20:48 ` pinskia at gcc dot gnu.org
  2021-08-12  1:17 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-04 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Clang and GCC both accept the code slightly.
ICC accepts the code with a warning:
<source>(1): warning #2922: template parameter "U" cannot be used because it
follows a parameter pack and cannot be deduced from the parameters of function
template "f"
  template<class... T, class... U> void f() { }
                                ^

<source>(2): warning #2922: template parameter "U" cannot be used because it
follows a parameter pack and cannot be deduced from the parameters of function
template "g"
  template<class... T, class U> void g() { }
                             ^


MSVC rejects the code:
<source>(1): error C3547: template parameter 'U' cannot be used because it
follows a template parameter pack and cannot be deduced from the function
parameters of 'f'
<source>(1): note: see declaration of 'U'
<source>(2): error C3547: template parameter 'U' cannot be used because it
follows a template parameter pack and cannot be deduced from the function
parameters of 'g'
<source>(2): note: see declaration of 'U'

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/61953] [C++11] The template parameter pack of a function template should be the last template parameter
  2014-07-29 16:23 [Bug c++/61953] New: [C++11] The template parameter pack of a function template should be the last template parameter kariya_mitsuru at hotmail dot com
                   ` (2 preceding siblings ...)
  2021-08-04 20:48 ` pinskia at gcc dot gnu.org
@ 2021-08-12  1:17 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12  1:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 69623.

*** This bug has been marked as a duplicate of bug 69623 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-12  1:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29 16:23 [Bug c++/61953] New: [C++11] The template parameter pack of a function template should be the last template parameter kariya_mitsuru at hotmail dot com
2014-12-14  0:42 ` [Bug c++/61953] " ville.voutilainen at gmail dot com
2014-12-14  0:42 ` ville.voutilainen at gmail dot com
2021-08-04 20:48 ` pinskia at gcc dot gnu.org
2021-08-12  1:17 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).