Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
April 13, 2011 [Issue 5843] New: Unable to format (writeln) a struct with an alias-this to long/ulong. | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5843 Summary: Unable to format (writeln) a struct with an alias-this to long/ulong. Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: kennytm@gmail.com --- Comment #0 from kennytm@gmail.com 2011-04-13 09:03:00 PDT --- Test case: ----- import std.stdio; struct S { ulong a; alias a this; } void main() { writeln(S.init); } ----- As of 2.052, this code generates compile-time error with /usr/include/phobos/std/conv.d(99): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) does not match any function template declaration /usr/include/phobos/std/conv.d(99): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) cannot deduce template function from argument types !(int)(S) /usr/include/phobos/std/conv.d(99): Error: template instance errors instantiating template /usr/include/phobos/std/format.d(1630): Error: template instance std.conv.to!(int).to!(S) error instantiating /usr/include/phobos/std/format.d(335): instantiated from here: getNthInt!(S) /usr/include/phobos/std/stdio.d(660): instantiated from here: formattedWrite!(LockingTextWriter,immutable(char),S) /usr/include/phobos/std/stdio.d(1493): instantiated from here: write!(S,char) x.d(9): instantiated from here: writeln!(S) /usr/include/phobos/std/format.d(335): Error: template instance std.format.getNthInt!(S) error instantiating /usr/include/phobos/std/stdio.d(660): instantiated from here: formattedWrite!(LockingTextWriter,immutable(char),S) /usr/include/phobos/std/stdio.d(1493): instantiated from here: write!(S,char) x.d(9): instantiated from here: writeln!(S) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 02, 2011 [Issue 5843] Unable to convert a struct with an alias-this to long/ulong to int, using std.conv.to!int. | ||||
---|---|---|---|---|
| ||||
Posted in reply to kennytm@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5843 kennytm@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Unable to format (writeln) |Unable to convert a struct |a struct with an alias-this |with an alias-this to |to long/ulong. |long/ulong to int, using | |std.conv.to!int. --- Comment #1 from kennytm@gmail.com 2011-06-02 10:28:36 PDT --- The underlying problem is to!int of the struct isn't defined. ------------------------- import std.conv; struct SSSS { long a; alias a this; } void main() { to!int(SSSS.init); } ------------------------- /usr/include/phobos/std/conv.d(99): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) does not match any function template declaration /usr/include/phobos/std/conv.d(99): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) cannot deduce template function from argument types !(int)(SSSS) /usr/include/phobos/std/conv.d(99): Error: template instance errors instantiating template x.d(7): Error: template instance std.conv.to!(int).to!(SSSS) error instantiating ------------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 23, 2012 [Issue 5843] Unable to convert a struct with an alias-this to long/ulong to int, using std.conv.to!int. | ||||
---|---|---|---|---|
| ||||
Posted in reply to kennytm@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5843 SomeDude <lovelydear@mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear@mailmetrash.com --- Comment #2 from SomeDude <lovelydear@mailmetrash.com> 2012-04-23 09:06:43 PDT --- Both examples compile and run with 2.059 Win32. The first one displays 0. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 23, 2012 [Issue 5843] Unable to convert a struct with an alias-this to long/ulong to int, using std.conv.to!int. | ||||
---|---|---|---|---|
| ||||
Posted in reply to kennytm@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5843 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-04-23 10:42:36 PDT --- In 2.059, std.format module treats alias this type properly. It was fixed by the pull request: https://github.com/D-Programming-Language/phobos/pull/488 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation