D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1099 - weird tupleof behavior in mixins
Summary: weird tupleof behavior in mixins
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2007-04-05 21:10 UTC by Tomasz Stachowiak
Modified: 2014-02-16 15:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Tomasz Stachowiak 2007-04-05 21:10:26 UTC
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 2 Tomasz Stachowiak 2008-06-28 06:30:01 UTC
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 github-bugzilla 2012-05-14 16:20:14 UTC
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