problem with Tuple over user-defined class
Koroskin Denis
2korden at gmail.com
Wed Jul 2 09:57:14 PDT 2008
On Wed, 02 Jul 2008 20:43:03 +0400, baleog <maccarka at 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?
More information about the Digitalmars-d-learn
mailing list