Bug 39653 - [C++0x] error referencing a more specialized variadic template from primary
Summary: [C++0x] error referencing a more specialized variadic template from primary
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 46061 (view as bug list)
Depends on: 35722
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-05 17:11 UTC by Martin Sebor
Modified: 2011-10-03 00:26 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Sebor 2009-04-05 17:11:16 UTC
I believe the following program is well-formed but gcc rejects it with
the same error as the one discussed in bug 35722. I'm opening this as
a separate bug since unlike in bug 35722, the referenced template is
variadic.

$ cat t.C && g++ --version && g++ -std=c++0x t.C
template <class T, class ...Types>
struct S {
    typedef typename S<Types...>::type type;
};

template <class T>
struct S<T> { typedef T type; };
g++ (GCC) 4.5.0 20090404 (experimental)
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

t.C:3: sorry, unimplemented: cannot expand ‘Types ...’ into a fixed-length argument list
Comment 1 Jason Merrill 2009-04-05 19:35:27 UTC
I'd write that as

template <class... Types>
struct S;

template <class T, class ...Types>
struct S<T, Types...> {
    typedef typename S<Types...>::type type;
};

template <class T>
struct S<T> { typedef T type; };
Comment 2 Jonathan Wakely 2010-10-18 12:06:55 UTC
*** Bug 46061 has been marked as a duplicate of this bug. ***
Comment 3 Jason Merrill 2011-10-03 00:26:27 UTC
Fixed by the patch for bug 35722.