Thread overview | |||||
---|---|---|---|---|---|
|
July 02, 2008 problem with Tuple over user-defined class | ||||
---|---|---|---|---|
| ||||
Hello, Tuple from the typecons works fine with the basic data types. But not with the user-defined classes. Test code: -- import std.typecons; class A { int x; } unittest { Tuple!(int) x; // works fine Tuple(A) y; /* Error: identifier 'A' is not defined Error: A is used as a type ~/dmd/src/phobos/std/typecons.d: variable std.typecons.Values!(A).Tuple.T voids have no value */ } -- does it possible to use Tuple struct from typecons with the user-defined class? Thank you p.s. dmd-2.014 |
July 02, 2008 Re: problem with Tuple over user-defined class | ||||
---|---|---|---|---|
| ||||
Posted in reply to baleog | baleog Wrote:
> Tuple(A) y; /* Error: identifier 'A' is not defined
need to read "Tuple!(A) y;"
sorry
|
July 02, 2008 Re: problem with Tuple over user-defined class | ||||
---|---|---|---|---|
| ||||
Posted in reply to baleog | On Wed, 02 Jul 2008 20:43:03 +0400, baleog <maccarka@yahoo.com> wrote: > Hello, > Tuple from the typecons works fine with the basic data types. But not with the user-defined classes. > Test code: > -- > import std.typecons; > class A > { > int x; > } > > unittest > { > Tuple!(int) x; // works fine > Tuple(A) y; /* Error: identifier 'A' is not defined > Error: A is used as a type > ~/dmd/src/phobos/std/typecons.d: variable std.typecons.Values!(A).Tuple.T voids have no value */ > } > -- > does it possible to use Tuple struct from typecons with the user-defined class? > > Thank you > > p.s. dmd-2.014 Confirm, 2.009 and 2.015 suffer from the same problem. Don't have other versions nearby to test. Simplified test case: Test.d ~~~~~~ import std.typecons; class A { int x; } Tuple!(A) y; // end of Test.d Output: Error: identifier 'A' is not defined Error: A is used as a type C:\dmd\bin\..\src\phobos\std\typecons.d: variable std.typecons.Tuple!(A).Tuple._0 voids have no value C:\dmd\bin\..\src\phobos\std\typecons.d(522): template instance std.typecons.Tuple!(A) error instantiating Line numbers not mentioned, too. Anyone fills the bug report? |
Copyright © 1999-2021 by the D Language Foundation