Bug w/tuple of custom types?
Steven Schveighoffer
schveiguy at yahoo.com
Mon Mar 21 10:40:07 PDT 2011
On Mon, 21 Mar 2011 13:03:25 -0400, Magnus Lie Hetland
<magnus at hetland.org> wrote:
> Sample program:
>
> import std.typecons;
>
> typedef uint oid_t;
>
> void main() {
> Tuple!(uint,uint) key;
> // Tuple!(oid_t,oid_t) key; // Doesn't work
> }
>
> If I use the last tuple instead of the first, I get the following
> compiler error with DMD 2.052 in OS X:
>
> /path/to/src/phobos/std/format.d(1579): Error: function
> std.format.formatValue!(Appender!(string),oid_t,immutable(char)).formatValue
> is deprecated
> /path/to/src/phobos/std/format.d(306): Error: template instance
> std.format.formatGeneric!(Appender!(string),oid_t,immutable(char)) error
> instantiating
> /path/to/src/phobos/std/typecons.d(507): instantiated from here:
> formattedWrite!(Appender!(string),immutable(char),oid_t)
>
> It seems that std.typecons is using a deprecated formatting API, which
> is triggered by my use of a custom type? And ... I guess this would be a
> bug? (I looked in the tracker, and couldn't find it there already.)
>
If you looked and couldn't find it, it doesn't hurt to add it. Worst case
-- it gets marked as a duplicate.
Note that typedef is eventually going to be deprecated. I'd suggest using
alias unless you have a need to force uints not to be castable to oid_t.
-Steve
More information about the Digitalmars-d-learn
mailing list