www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9650] New: __traits(compiles) + mixin

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650

           Summary: __traits(compiles) + mixin
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: callumenator gmail.com



DMD2.062:

http://forum.dlang.org/thread/vnnmmwhoyrdtbglqxqkz forum.dlang.org#post-tdojcnsrtkygjbhwegph:40forum.dlang.org

import std.conv;

void main()
{
    enum s = "`1`.to!int;";
    enum c = __traits(compiles, mixin("{auto a = new "~s~";}")); // line 1
    mixin("auto a = "~s~";");  // line 2
}

Long errors about instantiating std.conv.to!(int).to!(string). Swap lines 1 and
2 and compilation succeeds. This worked in 2.061. Possibly related to issue
9017.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 05 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid



https://github.com/D-Programming-Language/dmd/pull/1728

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ac89791f2a4c54cb255ee7e802fde74643b12412
fix Issue 9650 - __traits(compiles) + mixin

I couldn't minimize test case, but the bug fix is obvious.

The bug had been hiding for a long time, but recent Phobos change
(https://github.com/D-Programming-Language/phobos/commit/2a88fea7867f33fd1cf15c2dca7790a3c8aea474)
had exposed the bug.

When a mixin expression gets invalid code string, the parsing error had not
handled correctly. In such case, it had generated *invalid* AST instead of
returning ErrorExp. I guess that the invalid AST would report weird error in
later semantic analysis.

I think that both CompileDeclaration and CompileStatement do not have same
problem. So they are not changed.

https://github.com/D-Programming-Language/dmd/commit/618d8277aaf20c9f8d8eebc39289e3d2a1c63d42


Issue 9650 - __traits(compiles) + mixin

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650




Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a4de3b4e56fd70e0982eed2a55abdc6df20d18db


Issue 9650 - __traits(compiles) + mixin

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
            Version|D2                          |D1 & D2
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9650




Commit pushed to 2.062 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f62c899fecf3ab58e9d20d1b413bfb06f0d26a95


Issue 9650 - __traits(compiles) + mixin

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