www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - problem with Tuple over user-defined class

reply baleog <maccarka yahoo.com> writes:
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
Jul 02 2008
next sibling parent baleog <maccarka yahoo.com> writes:
baleog Wrote:
   Tuple(A) y; /* Error: identifier 'A' is not defined

sorry
Jul 02 2008
prev sibling parent "Koroskin Denis" <2korden gmail.com> writes:
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?
Jul 02 2008