[Issue 1603] String literals bind to pointer types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 21 10:28:32 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1603
smjg at iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |spec
Summary|Overload sets bug |String literals bind to
| |pointer types
------- Comment #3 from smjg at iname.com 2007-10-21 12:28 -------
(In reply to comment #2)
> Literal strings should not bind to const char *.
By my experiments, string literals are simultaneously of all of these types:
invariant(char)*
invariant(wchar)*
invariant(dchar)*
invariant(char)[]
invariant(wchar)[]
invariant(dchar)[]
and therefore to the const versions of these types. But there doesn't seem to
be any documentation to the fact that they bind to the pointer types (unless I
haven't found it).
So the issue has nothing to do with overload sets. Try this and see.
----------
extern(C) void foo(in char*) {}
void main() {
foo("string");
}
invariant(char)* cp = "string";
invariant(wchar)* wp = "string";
invariant(dchar)* dp = "string";
invariant(char)[] ca = "string";
invariant(wchar)[] wa = "string";
invariant(dchar)[] da = "string";
----------
And why is this issue set to version 2.007? That version isn't even out yet.
--
More information about the Digitalmars-d-bugs
mailing list