Bug 12035 – Regression 2.065: Mixin string inside mixin template inside template can no longer acces template argument

Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-29T12:14:00Z
Last change time
2014-03-18T20:49:33Z
Assigned to
nobody
Creator
code

Attachments

IDFilenameSummaryContent-TypeSize
1317repro.ziprepro caseapplication/zip642

Comments

Comment #0 by code — 2014-01-29T12:14:59Z
Created attachment 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.
Comment #1 by k.hara.pg — 2014-01-29T17:46:58Z
(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.
Comment #2 by k.hara.pg — 2014-03-18T20:49:33Z
*** Issue 12371 has been marked as a duplicate of this issue. ***