* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
[not found] <bug-35722-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-04 22:53 ` dodji at gcc dot gnu.org
2011-05-20 17:20 ` 3dw4rd at verizon dot net
` (6 subsequent siblings)
7 siblings, 0 replies; 22+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-01-04 22:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
Dodji Seketeli <dodji at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |dodji at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
[not found] <bug-35722-4@http.gcc.gnu.org/bugzilla/>
2011-01-04 22:53 ` [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template dodji at gcc dot gnu.org
@ 2011-05-20 17:20 ` 3dw4rd at verizon dot net
2011-05-20 20:05 ` tristan.wibberley at gmail dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 22+ messages in thread
From: 3dw4rd at verizon dot net @ 2011-05-20 17:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
Ed Smith-Rowland <3dw4rd at verizon dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |3dw4rd at verizon dot net
--- Comment #13 from Ed Smith-Rowland <3dw4rd at verizon dot net> 2011-05-20 16:55:48 UTC ---
I this supposed to work too?
// This is going to be a variadic array.
#include <cstddef>
#include <type_traits>
template<typename T, std::size_t Dim, std::size_t... Dims>
struct tensor
{
public:
typedef std::conditional<sizeof...(Dims) == 0, T, tensor<T, Dims...>>
_Elem;
_Elem elem[Dim]; // (Dim == 0 ? 1 : Dim) like array?
};
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
[not found] <bug-35722-4@http.gcc.gnu.org/bugzilla/>
2011-01-04 22:53 ` [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template dodji at gcc dot gnu.org
2011-05-20 17:20 ` 3dw4rd at verizon dot net
@ 2011-05-20 20:05 ` tristan.wibberley at gmail dot com
2011-09-27 15:35 ` dodji at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 22+ messages in thread
From: tristan.wibberley at gmail dot com @ 2011-05-20 20:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
--- Comment #14 from Tristan Wibberley <tristan.wibberley at gmail dot com> 2011-05-20 19:30:15 UTC ---
Ed,
It depends on the rest of your program that you cut out. As given, no it's
not supposed to work.
see http://gcc.gnu.org/bugs/ for how to report your problem if you have a
good reason to think there's a bug. But for help with c++ you need to go
elsewhere for example the ##c++ chatroom on IRC chat as detailed at
http://freenode.net/
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
[not found] <bug-35722-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-05-20 20:05 ` tristan.wibberley at gmail dot com
@ 2011-09-27 15:35 ` dodji at gcc dot gnu.org
2011-10-02 21:46 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 22+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-09-27 15:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
Dodji Seketeli <dodji at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
AssignedTo|dodji at gcc dot gnu.org |unassigned at gcc dot
| |gnu.org
--- Comment #15 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-09-27 14:46:22 UTC ---
Unassigning myself as I am not working on this right now.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
[not found] <bug-35722-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2011-09-27 15:35 ` dodji at gcc dot gnu.org
@ 2011-10-02 21:46 ` jason at gcc dot gnu.org
2011-10-02 21:53 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-02 21:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
--- Comment #16 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-02 21:45:08 UTC ---
Author: jason
Date: Sun Oct 2 21:45:01 2011
New Revision: 179436
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179436
Log:
PR c++/35722
Implement N2555 (expanding pack expansion to fixed parm list)
* pt.c (coerce_template_parms): Allow expanding a pack expansion
to a fixed-length argument list.
(unify_pack_expansion): Handle explicit args properly.
(unify) [TREE_VEC]: Handle pack expansions here.
[TYPE_ARGUMENT_PACK]: Not here.
(tsubst_pack_expansion): Don't try to do partial substitution.
(pack_deducible_p): New.
(fn_type_unification): Use it.
(find_parameter_packs_r): Take the TYPE_MAIN_VARIANT
of a type parameter.
(check_non_deducible_conversion): Split from type_unification_real.
(unify_one_argument): Split from type_unification_real...
(unify_pack_expansion): ...and here. Drop call_args_p parm.
(type_unification_real, unify, more_specialized_fn): Adjust.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/variadic-explicit1.C
trunk/gcc/testsuite/g++.dg/cpp0x/variadic-nondeduce1.C
trunk/gcc/testsuite/g++.dg/cpp0x/variadic117.C
trunk/gcc/testsuite/g++.dg/cpp0x/variadic118.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/variadic105.C
trunk/gcc/testsuite/g++.dg/cpp0x/variadic35.C
trunk/gcc/testsuite/g++.dg/cpp0x/variadic65.C
trunk/gcc/testsuite/g++.dg/cpp0x/variadic82.C
trunk/gcc/testsuite/g++.dg/cpp0x/variadic83.C
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/testsuite/util/testsuite_tr1.h
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
[not found] <bug-35722-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2011-10-02 21:46 ` jason at gcc dot gnu.org
@ 2011-10-02 21:53 ` jason at gcc dot gnu.org
2011-10-14 19:17 ` jason at gcc dot gnu.org
2012-04-16 2:12 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-02 21:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
Target Milestone|--- |4.7.0
--- Comment #17 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-02 21:53:23 UTC ---
Fixed for 4.7.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
[not found] <bug-35722-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2011-10-02 21:53 ` jason at gcc dot gnu.org
@ 2011-10-14 19:17 ` jason at gcc dot gnu.org
2012-04-16 2:12 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-14 19:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lcid-fire at gmx dot net
--- Comment #18 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-14 19:16:25 UTC ---
*** Bug 50140 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
[not found] <bug-35722-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2011-10-14 19:17 ` jason at gcc dot gnu.org
@ 2012-04-16 2:12 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-16 2:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sausage at tehsausage dot
| |com
--- Comment #19 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-16 02:10:37 UTC ---
*** Bug 45873 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
@ 2008-03-27 17:32 ` dgregor at gcc dot gnu dot org
2008-12-02 17:51 ` jason at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-03-27 17:32 UTC (permalink / raw)
To: gcc-bugs
--
dgregor at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |dgregor at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-03-27 17:31:52
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
2008-03-27 17:32 ` [Bug c++/35722] " dgregor at gcc dot gnu dot org
@ 2008-12-02 17:51 ` jason at gcc dot gnu dot org
2009-01-06 19:47 ` jason at gcc dot gnu dot org
` (11 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-12-02 17:51 UTC (permalink / raw)
To: gcc-bugs
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|dgregor at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
2008-03-27 17:32 ` [Bug c++/35722] " dgregor at gcc dot gnu dot org
2008-12-02 17:51 ` jason at gcc dot gnu dot org
@ 2009-01-06 19:47 ` jason at gcc dot gnu dot org
2009-01-07 0:06 ` jason at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-01-06 19:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jason at gcc dot gnu dot org 2009-01-06 19:47 -------
This was ill-formed under the proposal that was initially adopted, but was made
well-formed in the March 2008 working paper when the following wording was
struck from the end of 14.3:
A template-argument pack expansion shall not occur in a simple-template-id
whose template-name refers to a class template unless the
template-parameter-list of that class template declares a template parameter
pack.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-01-06 19:47 ` jason at gcc dot gnu dot org
@ 2009-01-07 0:06 ` jason at gcc dot gnu dot org
2009-04-04 23:12 ` sebor at roguewave dot com
` (9 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-01-07 0:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jason at gcc dot gnu dot org 2009-01-07 00:06 -------
This was part of the incorporation of N2555
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf) into the
WP.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-01-07 0:06 ` jason at gcc dot gnu dot org
@ 2009-04-04 23:12 ` sebor at roguewave dot com
2009-04-05 4:20 ` jason at gcc dot gnu dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: sebor at roguewave dot com @ 2009-04-04 23:12 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1769 bytes --]
------- Comment #3 from sebor at roguewave dot com 2009-04-04 23:12 -------
This limitation makes implementing the latest std::tuple difficult. Quoting
from a post to c++std-lib@accu.org:
Martin Sebor wrote:
> To: C++ libraries mailing list
> Message c++std-lib-23549
>
> After reducing the error to a smaller test case and some digging
> through gcc Bugzilla it looks as though it is well-formed but gcc
> doesn't implement it yet:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
>
> The errors are different but the problem seems the same in both
> cases.
>
> Martin Sebor wrote:
>> To: C++ libraries mailing list
>> Message c++std-lib-23548
>>
>> I'm probably missing something but can someone confirm that the
>> declaration of the tuple ctor below (taken from N2857) is well
>> formed given that pair is not a variadic template?
>>
>> The latest gcc complains:
>>
>> error: wrong number of template arguments (1, should be 2)
>>
>> Thanks!
>>
>> template <VariableType... Types>
>> class tuple
>> {
>> public:
>> ...
>> template <Allocator Alloc, class... UTypes>
>> requires ConstructibleWithAllocator<Types, Alloc, const UTypes&>...
>> tuple(allocator_arg_t, const Alloc& a, const pair<UTypes...>&);
>> ...
>> };
>>
>>
>> Here's a small test case:
>>
>> $ cat t.C && g++ -std=c++0x t.C
>> template <class T, class U> struct pair { };
>> struct allocator_arg_t { };
>> template <class ...T>
>> struct tuple {
>> template <class U, class ...V>
>> tuple (allocator_arg_t, const U&, const pair<V...>&);
>> };
>> t.C:6: error: wrong number of template arguments (1, should be 2)
>> t.C:1: error: provided for template<class T, class U> struct pair
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-04-04 23:12 ` sebor at roguewave dot com
@ 2009-04-05 4:20 ` jason at gcc dot gnu dot org
2009-04-05 14:20 ` sebor at roguewave dot com
` (7 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-04-05 4:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jason at gcc dot gnu dot org 2009-04-05 04:20 -------
I agree that the working paper says that this should work, but I'm not sure why
the language should specify the use of variadics there; why not
template <Allocator Alloc, class First, class Second>
requires ConstructibleWithAllocator<Types, Alloc, const First&>
&& ConstructibleWithAllocator<Types, Alloc, const Second&>
tuple(allocator_arg_t, const Alloc& a, const pair<First, Second>&);
instead? The n2555 fix is needed for template template parameters, but in
cases like this where we know what template we're dealing with I don't see why
it's a problem to just pass in the right number of arguments.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-04-05 4:20 ` jason at gcc dot gnu dot org
@ 2009-04-05 14:20 ` sebor at roguewave dot com
2009-04-05 17:12 ` sebor at roguewave dot com
` (6 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: sebor at roguewave dot com @ 2009-04-05 14:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from sebor at roguewave dot com 2009-04-05 14:20 -------
(In reply to comment #4)
The change was introduced in N2622:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2622.pdf
I couldn't find a rationale for the change. Doug might remember
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (6 preceding siblings ...)
2009-04-05 14:20 ` sebor at roguewave dot com
@ 2009-04-05 17:12 ` sebor at roguewave dot com
2009-04-05 19:34 ` jason at gcc dot gnu dot org
` (5 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: sebor at roguewave dot com @ 2009-04-05 17:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from sebor at roguewave dot com 2009-04-05 17:12 -------
See also bug 39642 and bug 39653.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (7 preceding siblings ...)
2009-04-05 17:12 ` sebor at roguewave dot com
@ 2009-04-05 19:34 ` jason at gcc dot gnu dot org
2009-08-13 5:01 ` jack dot q dot word at gmail dot com
` (4 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-04-05 19:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jason at gcc dot gnu dot org 2009-04-05 19:33 -------
*** Bug 39642 has been marked as a duplicate of this bug. ***
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |piotr dot wyderski at gmail
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (8 preceding siblings ...)
2009-04-05 19:34 ` jason at gcc dot gnu dot org
@ 2009-08-13 5:01 ` jack dot q dot word at gmail dot com
2009-08-13 5:05 ` jack dot q dot word at gmail dot com
` (3 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: jack dot q dot word at gmail dot com @ 2009-08-13 5:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jack dot q dot word at gmail dot com 2009-08-13 05:01 -------
Created an attachment (id=18348)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18348&action=view)
tuple & union examples with possibly proper variadic return type case relying
on variadic template expansion
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (9 preceding siblings ...)
2009-08-13 5:01 ` jack dot q dot word at gmail dot com
@ 2009-08-13 5:05 ` jack dot q dot word at gmail dot com
2009-08-13 5:06 ` jack dot q dot word at gmail dot com
` (2 subsequent siblings)
13 siblings, 0 replies; 22+ messages in thread
From: jack dot q dot word at gmail dot com @ 2009-08-13 5:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jack dot q dot word at gmail dot com 2009-08-13 05:04 -------
(In reply to comment #8)
> Created an attachment (id=18348)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18348&action=view) [edit]
> tuple & union examples with possibly proper variadic return type case relying
> on variadic template expansion
>
the unnamed structs/unions, and RecursiveStruct/Union can be discarded, and use
'byte Data[VarTypeNav< cT, vT...>::Size];' ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (10 preceding siblings ...)
2009-08-13 5:05 ` jack dot q dot word at gmail dot com
@ 2009-08-13 5:06 ` jack dot q dot word at gmail dot com
2009-08-13 5:14 ` jack dot q dot word at gmail dot com
2010-01-22 9:12 ` chris at bubblescope dot net
13 siblings, 0 replies; 22+ messages in thread
From: jack dot q dot word at gmail dot com @ 2009-08-13 5:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jack dot q dot word at gmail dot com 2009-08-13 05:05 -------
> 'byte Data[VarTypeNav< cT, vT...>::Size];' ...
or 'char Data[VarTypeNav< cT, vT...>::Size];' ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (11 preceding siblings ...)
2009-08-13 5:06 ` jack dot q dot word at gmail dot com
@ 2009-08-13 5:14 ` jack dot q dot word at gmail dot com
2010-01-22 9:12 ` chris at bubblescope dot net
13 siblings, 0 replies; 22+ messages in thread
From: jack dot q dot word at gmail dot com @ 2009-08-13 5:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jack dot q dot word at gmail dot com 2009-08-13 05:14 -------
(From update of attachment 18348)
template< class cT, class... vT >
struct VarTypeNav
{
typedef cT T;
typedef VarTypeNav< vT..., void > Next;
struct scT { cT v; };
static const size_t Size =
sizeof(scT) + Next::Size;
static const size_t Count =
1 + Next::Count;
};
template< class... vT >
struct VarTypeNav< void, vT... >
{
typedef void T;
typedef void Next;
static const size_t Size = 0;
static const size_t Count = 0;
};
template< const size_t nIndex, class cT, class... vT >
struct VarTypeSelect
{
typedef VarTypeSelect< nIndex-1, vT... >::T T;
struct scT { T v; };
static const size_t Offset =
sizeof(scT) + VarTypeSelect< nIndex-1, vT... >::Offset;
};
template< class cT, class... vT >
struct VarTypeSelect< 0, cT, vT... >
{
typedef cT T;
static const size_t Offset = 0;
};
template< class cT, class... vT >
struct Tuple
{
char Data[VarTypeNav<cT,vT...>::Size];
template< const size_t index >
VarTypeSelect< index, vT... >::T & operator [] ( const size_t index )
{
static_assert(!(index > VarTypeNav< vT... >::Count ), "Index
out of bounds");
char * pThisChars = (char *) this;
return *(
(VarTypeSelect< index, vT... >::T *)
pThisChars[ VarTypeSelect< index, vT...
>::Offset ]));
}
template< const size_t index >
const VarTypeSelect< index, vT... >::T & operator [] ( const size_t
index ) const
{
static_assert(!(index > VarTypeNav< vT... >::Count ), "Index
out of bounds");
const char * pThisChars = (const char *) this;
return *(
(const VarTypeSelect< index, vT... >::T *)
pThisChars[ VarTypeSelect< index, vT...
>::Offset ]));
}
};
int main() {
Tuple< size_t, char * > x; /* = { 32, new char[32] }; *//* ? */
x[0] = 32;
x[1] = new char[32];
x[1][31] = 0;
return (int) &x[1][0] != 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug c++/35722] [C++0x] Variadic templates expansion into non-variadic class template
2008-03-27 17:32 [Bug c++/35722] New: " dgregor at gcc dot gnu dot org
` (12 preceding siblings ...)
2009-08-13 5:14 ` jack dot q dot word at gmail dot com
@ 2010-01-22 9:12 ` chris at bubblescope dot net
13 siblings, 0 replies; 22+ messages in thread
From: chris at bubblescope dot net @ 2010-01-22 9:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from chris at bubblescope dot net 2010-01-22 09:11 -------
Just for anyone who comes to this bug, it can be worked around by doing
something like:
template<template <typename...> T, typename... Args>
struct Join
{ typedef T<Args...> type; }
Although of course that isn't a fix (and unfortunately a fix is beyond me).
--
chris at bubblescope dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |chris at bubblescope dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35722
^ permalink raw reply [flat|nested] 22+ messages in thread