Thread overview | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 22, 2012 [Issue 7348] New: to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7348 Summary: to!string(null) matches more than one template declaration Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: trivial Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: alienballance@gmail.com --- Comment #0 from Mariusz Gliwiński <alienballance@gmail.com> 2012-01-22 09:56:28 PST --- import std.conv; void main() { to!string(null); } /usr/include/d/std/conv.d(237): Error: template std.conv.toImpl(T,S) if (isImplicitlyConvertible!(S,T)) toImpl(T,S) if (isImplicitlyConvertible!(S,T)) matches more than one template declaration, /usr/include/d/std/conv.d(245):toImpl(T,S) if (isImplicitlyConvertible!(S,T)) and /usr/include/d/std/conv.d(924):toImpl(T,S) if (is(S : Object) && isSomeString!(T)) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 23, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-01-22 16:48:29 PST --- While I can see wanting this to work, I'm not sure how it could. What type is null? Is it string? A wstring? An int[]? An Object? If so, is it an Object or a class derived from Object? Etc. And if what you want is a null string, then just assign null to the string. What are you trying to do here? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 23, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 --- Comment #2 from Mariusz Gliwiński <alienballance@gmail.com> 2012-01-23 11:58:31 PST --- [quote]What are you trying to do here?[/quote] void test(A)(A param) { writeln("A(",text(param),") called"); } void main() { test(null); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 23, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 --- Comment #3 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-01-23 13:49:20 PST --- Yeah. That doesn't really make sense. null could be anything that's null. And what type that is completely changes how text is instantiated. If you cast null to the type that you want, then it'll work. But null is its own type. You can't really do anything with null on its own like that. It needs be a null _something_, not just null. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 19, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 SomeDude <lovelydear@mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear@mailmetrash.com --- Comment #4 from SomeDude <lovelydear@mailmetrash.com> 2012-04-19 09:55:21 PDT --- Should we close ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 19, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #5 from bearophile_hugs@eml.cc 2012-04-19 15:07:52 PDT --- (In reply to comment #4) > Should we close ? Don't close unless it's really unfixable in some way. Maybe "void*" is an acceptable textual output for this. --------------------- Related: import std.stdio; void main() { writeln(null); } DMD 2.059 shows: ...\dmd2\src\phobos\std\stdio.d(1562): Error: undefined identifier 'length' ...\dmd2\src\phobos\std\stdio.d(1562): Error: undefined identifier 'ptr', did you mean 'template tr(C1,C2,C3,C4 = immutable(char))'? test.d(3): Error: template instance std.stdio.writeln!(typeof(null)) error instantiating -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 19, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 --- Comment #6 from SomeDude <lovelydear@mailmetrash.com> 2012-04-19 15:52:44 PDT --- > Don't close unless it's really unfixable in some way. Seriously, this doesn't make any sense. It's always possible to break the language with stupid examples like this. This is a waste of time and resources. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 19, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 Vladimir Panteleev <thecybershadow@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |thecybershadow@gmail.com --- Comment #7 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-04-19 16:01:56 PDT --- I think this bug is valid. text(null) should be equal to "null". I don't see how this falls under "breaking the language". The OP posted a plausible use case (logging the calls to a templated function), so calling this "stupid" is a bit over the line. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 12, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #8 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-12 09:22:49 PDT --- Now to!string(null) returns cast(string)null. Because null is implicitly convertible to string. Unit-test only: https://github.com/D-Programming-Language/phobos/pull/575 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 22, 2012 [Issue 7348] to!string(null) matches more than one template declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mariusz Gliwiński | http://d.puremagic.com/issues/show_bug.cgi?id=7348 --- Comment #9 from github-bugzilla@puremagic.com 2012-05-22 12:40:00 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/2e3d877f769abcf6ea0a9c6a31902b8cbd02ba75 fix Issue 7348 - to!string(null) matches more than one template declaration -- 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