[Issue 5357] mixin templates accept strings as struct name

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 21 04:49:36 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5357



--- Comment #7 from Piotr Szturmaj <gacek999 at tlen.pl> 2010-12-21 04:47:38 PST ---
This is why I filled this bug report. I think it introduces a confusion,
Jonathan also got caught on that.

Consider following code:

mixin template Test(string s)
{
    static string str = s;
    //struct s { }
}

mixin Test!("text");

it compiles flawlessly. Now uncomment line with struct:

mixin template Test(string s)
{
    static string str = s;
    struct s { }
}

mixin Test!("text");

This time compiler fails with:
Error: cannot implicitly convert expression (s) of type s to string

Now it is impossible to refer to value parameter s. I think there should be at
least a warning which informs user that template declarations are hiding
template parameters.

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


More information about the Digitalmars-d-bugs mailing list