[Issue 11900] Implicit cast of string literal -> char* causing ambiguous call

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 11 01:21:28 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11900



--- Comment #4 from Manu <turkeyman at gmail.com> 2014-01-11 01:21:24 PST ---
(In reply to comment #3)
> (In reply to comment #2)
> > Well it's kinda like you say, this overload set is very common, if you have a C
> > function, and you want to produce a D wrapper which receives a string and calls
> > through using toStringz.
> 
> The ambiguity with string literal arguments probably means it's not overly
> common at this stage, but regardless, its popularity does not justify its use.
> We have no obligation to make concessions to enable bad code.

How is it a concession? It seems to me like the concession was already made to
make interacting with C functions easier. I'd say if anything, this is a bug
that stems from that decision.
There's nowhere else in D where a dynamic array can implicitly convert to a
pointer... why does it happen ONLY in the case of a string literal?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list