Bug 1099 – weird tupleof behavior in mixins

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-04-05T21:10:00Z
Last change time
2014-02-16T15:23:38Z
Keywords
wrong-code
Assigned to
nobody
Creator
h3r3tic

Comments

Comment #0 by h3r3tic — 2007-04-05T21:10:26Z
the following module should not compile, but it does. Tested with dmd 0.175, 1.010 and 1.010b. template Mix(int a) { alias typeof(*this) ThisType; static assert (ThisType.init.tupleof.length == a); } struct Foo { mixin Mix!(0); int foo; mixin Mix!(1); int bar; mixin Mix!(2); }
Comment #1 by thomas-dloop — 2007-04-06T04:14:53Z
Comment #2 by h3r3tic — 2008-06-28T06:30:01Z
Perhaps D is designed to work this way? Mixin template instances also don't see fields declared after their mixing-in point, so it's kind of consistent... But pretty weird/confusing anyway.
Comment #3 by github-bugzilla — 2012-05-14T16:20:14Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9024f3680dc69edc20268cbcd7277016d165641d Fix issue 1099 weird tupleof behavior in mixins Fixed some time ago, this is just the test case https://github.com/D-Programming-Language/dmd/commit/85c54827db14f5a547015ab4a19fdd677f5449aa Merge pull request #949 from donc/bug1099testcaseonly Fix issue 1099 weird tupleof behavior in mixins