D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7849 - Manifest constants don't resolve the polysemous literal type
Summary: Manifest constants don't resolve the polysemous literal type
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-07 03:57 UTC by timon.gehr
Modified: 2015-02-18 03:36 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description timon.gehr 2012-04-07 03:57:34 UTC
DMD 2.058/2.059head:

void foo(string){}
void foo(dstring){}
enum str = "string";
immutable stri = "string";
enum str2 = stri;
immutable stri2 = stri;
enum str3 = stri2;

void main(){
    foo(str);  // error
    foo(str2); // error
    foo(str3); // error
}

The code should compile, and the foo(string) overload should be called in all cases.
Comment 1 timon.gehr 2012-04-07 04:00:22 UTC
Without indirections via immutable static data, this even occurs if the type is given explicitly:

void foo(string){}
void foo(dstring){}
enum string str = "string";

void main(){
    foo(str); // error
}
Comment 2 SomeDude 2012-04-21 11:05:30 UTC
Compiles with 2.059 Win32
Comment 3 timon.gehr 2012-04-21 11:41:51 UTC
(In reply to comment #2)
> Compiles with 2.059 Win32

It seems to have been fixed indeed.
Comment 4 timon.gehr 2012-04-21 11:45:53 UTC
Reopening because there probably should be a regression test.
Comment 5 github-bugzilla 2014-09-14 21:55:51 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/65fcdb45094b45a3563ac583e5eef509dafe43cc
fix Issue 7849 - Manifest constants don't resolve the polysemous literal type
Comment 6 yebblies 2014-09-15 07:07:46 UTC
Adding a test case != FIXED.
Comment 7 Kenji Hara 2014-09-15 07:34:11 UTC
(In reply to yebblies from comment #6)
> Adding a test case != FIXED.

I remember that I had fixed similar IFTI issue, but I cannot recall the exact issue number. So I added test case and we can surely say this issue i s"fixed".
Comment 8 github-bugzilla 2015-02-18 03:36:54 UTC
Commit pushed to 2.067 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/65fcdb45094b45a3563ac583e5eef509dafe43cc
fix Issue 7849 - Manifest constants don't resolve the polysemous literal type