Thread overview
[Issue 12035] New: Regression 2.065: Mixin string inside mixin template inside template can no longer acces template argument
Jan 29, 2014
Benjamin Thaut
Jan 29, 2014
Benjamin Thaut
Jan 30, 2014
Kenji Hara
Mar 19, 2014
Kenji Hara
January 29, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12035

           Summary: Regression 2.065: Mixin string inside mixin template
                    inside template can no longer acces template argument
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: code@benjamin-thaut.de


--- Comment #0 from Benjamin Thaut <code@benjamin-thaut.de> 2014-01-29 12:14:59 PST ---
Created an attachment (id=1317)
repro case

I found this bug after bug 12023 was fixed. I used the latest version of the dmd master branch for this. The attached repro case is a heavily reduced version of my code.

The issue is that I can no longer reference the template Bar by name because its template argument Foo is in a different module and seems to be not known when the mixin inside the "b" module is compiled. This used to work fine with dmd 2.064 and all versions before that down to at least dmd 2.054.

Just compile all three modules together to see the issue.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 29, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12035


Benjamin Thaut <code@benjamin-thaut.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 30, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12035


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2014-01-29 17:46:58 PST ---
(In reply to comment #0)
> Created an attachment (id=1317) [details]
> repro case

In b.d, pragma(msg) prints the reason.

>    alias typeof(this) C;
>    pragma(msg, "static class Inner { " ~ C.stringof ~ " m_outer; }");

With 2.064, it prints:
static class Inner { Bar m_outer; }

With git-head, it prints:
static class Inner { Bar!(Foo) m_outer; }

The difference comes from the result of C.stringof. The change is introduced by fixing issue 1748.

In general, using stringof result for the mix-in code is wrong. In this case, you should use aliased name 'C'.

====

Note that, such the use of 'stringof' for code generation is not recommended now.

http://dlang.org/property#stringof

So this is just an invalid issue.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 19, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12035


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kozzi11@gmail.com


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2014-03-18 20:49:33 PDT ---
*** Issue 12371 has been marked as a duplicate of this issue. ***

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