public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50830] New: [c++0x] Variadic template, inner class error
@ 2011-10-22 14:46 trashyankes at wp dot pl
  2011-10-22 20:37 ` [Bug c++/50830] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: trashyankes at wp dot pl @ 2011-10-22 14:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

             Bug #: 50830
           Summary: [c++0x] Variadic template, inner class error
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: trashyankes@wp.pl
             Build: MinGW 4.6.0 20110210; MinGW 4.7.0 20110815


this code generate error `expected a class template, got 'template<class>
struct aa'` (case `a4` and `a5`)
when i remove every `...` its compile without problems

-----------------------------------------------------
template<class...>
struct list_type {};
template<template<class> class...>
struct list_templates {};

template<class>
struct aa {};
template<class>
struct bb {};

template<class... T>
struct test {};

template<template<class> class... F>
struct test<list_templates<F...>>
{
    struct inner {};
};
template<template<class> class... F, template<class> class... F2>
struct test<list_templates<F...>, list_templates<F2...>>
{
    struct inner {};
};

template<class... T>
struct test<list_type<T...>>
{
    struct inner {};
};
template<class... T,class... T2>
struct test<list_type<T...>, list_type<T2...>>
{
    struct inner {};
};

template<template<class> class... F, class... T>
struct test<list_templates<F...>, list_type<T...>>
{
    struct inner {};
};
test<list_templates<aa>> a1;
test<list_type<int>> a2;
test<list_type<int>, list_type<int>> a3;
test<list_templates<aa>, list_type<int>> a4; // error
test<list_templates<aa>, list_templates<bb>> a5; // error
-----------------------------------------------------


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
@ 2011-10-22 20:37 ` redi at gcc dot gnu.org
  2011-10-22 20:57 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-22 20:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-22 20:37:03 UTC ---
reduced:

template<template<class> class...>
struct list_templates {};

template<class>
struct aa {};

template<class... T>
struct test {};

template<template<class> class... F, class T>
struct test<list_templates<F...>, T>
{
    struct inner {};
};

test<list_templates<aa>, int> a4; // error


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
  2011-10-22 20:37 ` [Bug c++/50830] " redi at gcc dot gnu.org
@ 2011-10-22 20:57 ` redi at gcc dot gnu.org
  2011-10-22 21:07 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-22 20:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-22 20:57:04 UTC ---
The reduced example compiles if the partial specialization is declared so the
pack expansion is last:

template<class T, template<class> class... F>
struct test<list_templates<F...>, T>
{
    struct inner {};
};


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
  2011-10-22 20:37 ` [Bug c++/50830] " redi at gcc dot gnu.org
  2011-10-22 20:57 ` redi at gcc dot gnu.org
@ 2011-10-22 21:07 ` redi at gcc dot gnu.org
  2011-10-22 21:15 ` daniel.kruegler at googlemail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-22 21:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-22 21:07:31 UTC ---
(In reply to comment #0)
> when i remove every `...` its compile without problems

N.B. that doesn't mean this is a G++ bug


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (2 preceding siblings ...)
  2011-10-22 21:07 ` redi at gcc dot gnu.org
@ 2011-10-22 21:15 ` daniel.kruegler at googlemail dot com
  2011-10-22 22:02 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-10-22 21:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-10-22 21:15:20 UTC ---
(In reply to comment #3)
I agree, but the partial specialization

template<template<class> class... F, class T>
struct test<list_templates<F...>, T>;

should be fine, because only primary class templates require a template
parameter pack to be the last parameter (14.1 p11).


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (3 preceding siblings ...)
  2011-10-22 21:15 ` daniel.kruegler at googlemail dot com
@ 2011-10-22 22:02 ` redi at gcc dot gnu.org
  2011-10-23  9:52 ` daniel.kruegler at googlemail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-22 22:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-22 22:02:30 UTC ---
does the last sentence of [temp.class.spec] apply here?


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (4 preceding siblings ...)
  2011-10-22 22:02 ` redi at gcc dot gnu.org
@ 2011-10-23  9:52 ` daniel.kruegler at googlemail dot com
  2011-10-23 10:02 ` daniel.kruegler at googlemail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-10-23  9:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #6 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-10-23 09:51:44 UTC ---
[I assume you refer to p8 and the sentence: "If an argument is a pack expansion
(14.5.3), it shall be the last argument in the template argument list."]

No. list_templates<F...> is not an argument that *is* a pack expansion (but it
contains a pack expansion, which is fine). This sentence describes a situation
like the following:

template<class>
struct P;

template<class...>
struct X;

template<class... Ts, class T>
struct X<Ts..., P<T>> {};

This is ill-formed because the expansion Ts... is not at the end of the
argument list.

Changing it to

template<class... Ts, class T>
struct X<P<T>, Ts...> {};

would be OK, though.


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (5 preceding siblings ...)
  2011-10-23  9:52 ` daniel.kruegler at googlemail dot com
@ 2011-10-23 10:02 ` daniel.kruegler at googlemail dot com
  2011-10-23 11:29 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-10-23 10:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #7 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-10-23 10:02:19 UTC ---
I can only guess that there is a compiler defect in regard to handling variadic
template template parameters. The corresponding example

template<class...>
struct S;

template<class...>
struct X;

template<class... Ts, class T>
struct X<S<Ts...>, T> {};

X<S<int, bool>, double> x;

is accepted as expected.


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (6 preceding siblings ...)
  2011-10-23 10:02 ` daniel.kruegler at googlemail dot com
@ 2011-10-23 11:29 ` paolo.carlini at oracle dot com
  2012-04-16 15:53 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-23 11:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot
                   |                            |com

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-23 11:28:47 UTC ---
Note: about variadic template template we also have PR50303.


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (7 preceding siblings ...)
  2011-10-23 11:29 ` paolo.carlini at oracle dot com
@ 2012-04-16 15:53 ` jason at gcc dot gnu.org
  2012-04-17  2:38 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-16 15:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-04-16
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (8 preceding siblings ...)
  2012-04-16 15:53 ` jason at gcc dot gnu.org
@ 2012-04-17  2:38 ` jason at gcc dot gnu.org
  2012-04-17 14:16 ` jason at gcc dot gnu.org
  2012-04-17 15:46 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-17  2:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-17 02:29:40 UTC ---
Author: jason
Date: Tue Apr 17 02:29:35 2012
New Revision: 186520

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186520
Log:
    PR c++/50830
    * pt.c (convert_template_argument): Handle template template
    argument packs.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/variadic129.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (9 preceding siblings ...)
  2012-04-17  2:38 ` jason at gcc dot gnu.org
@ 2012-04-17 14:16 ` jason at gcc dot gnu.org
  2012-04-17 15:46 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-17 14:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-17 14:11:24 UTC ---
Author: jason
Date: Tue Apr 17 14:11:13 2012
New Revision: 186532

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186532
Log:
    PR c++/50830
    * pt.c (convert_template_argument): Handle template template
    argument packs.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/variadic129.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/50830] [c++0x] Variadic template, inner class error
  2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
                   ` (10 preceding siblings ...)
  2012-04-17 14:16 ` jason at gcc dot gnu.org
@ 2012-04-17 15:46 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-17 15:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50830

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.1

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-17 15:27:53 UTC ---
Fixed for 4.7.1.


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

end of thread, other threads:[~2012-04-17 15:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-22 14:46 [Bug c++/50830] New: [c++0x] Variadic template, inner class error trashyankes at wp dot pl
2011-10-22 20:37 ` [Bug c++/50830] " redi at gcc dot gnu.org
2011-10-22 20:57 ` redi at gcc dot gnu.org
2011-10-22 21:07 ` redi at gcc dot gnu.org
2011-10-22 21:15 ` daniel.kruegler at googlemail dot com
2011-10-22 22:02 ` redi at gcc dot gnu.org
2011-10-23  9:52 ` daniel.kruegler at googlemail dot com
2011-10-23 10:02 ` daniel.kruegler at googlemail dot com
2011-10-23 11:29 ` paolo.carlini at oracle dot com
2012-04-16 15:53 ` jason at gcc dot gnu.org
2012-04-17  2:38 ` jason at gcc dot gnu.org
2012-04-17 14:16 ` jason at gcc dot gnu.org
2012-04-17 15:46 ` jason 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).