[Issue 11837] String literals should convert to const(void)*

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 29 23:37:36 PST 2013


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



--- Comment #9 from yebblies <yebblies at gmail.com> 2013-12-30 18:37:33 EST ---
(In reply to comment #8)
> There's code in dmd to specifically disallow this. I believe the reason is
> because of function and template overloading.

Do you know what the actual problem is/was?  The code in dmd that disallows
this is ancient, and may well address a problem that no longer exists.

Can you remember why you disabled it in the first place?  Did you document this
anywhere?

As for overloading, this code works as expected as the conversion to
const(char)* is preferred.

import core.stdc.stdio;

void call(const(char)* str) { printf("const(char)*\n"); }
void call(const(void)* str) { printf("const(void)*\n"); }

void call(const(int)[] arr) { printf("const(int)[]\n"); }
void call(const(void)[] arr) { printf("const(void)[]\n"); }

void main()
{
    call("abc"); // prints const(char)*
    call([1, 2, 3]); // prints const(int)[]
}

> I'm not content with this change
> simply passing the existing test suite. It's a more subtle, substantive change
> than that.

What _would_ you be content with?  Unless someone can come up with an actual
problem, putting this on hold is simply a waste of time.  If this does turn out
to cause a regression, it can trivially be rolled back.

-- 
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