Bug 2606 – string literals unnecessarily prone to wide conversion
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-01-23T13:16:00Z
Last change time
2015-06-09T05:14:49Z
Assigned to
nobody
Creator
andrei
Comments
Comment #0 by andrei — 2009-01-23T13:16:22Z
void f(const(char)[] s) {}
void f(const(dchar)[] s) {}
void main()
{
f("abc");
auto a = "abc";
f(a);
}
The first call issues an ambiguity. This is inconsistent with the second call through a named variable.
String literals should receive an implicit preferred type and that should not make calls ambiguous.
Comment #1 by clugdbug — 2010-04-27T11:31:01Z
I think this is the same as bug 2367 (although with a stronger example).
Comment #2 by yebblies — 2011-06-15T07:51:48Z
*** This issue has been marked as a duplicate of issue 2367 ***