[Issue 7110] opSlice() & opIndex functions works unstable as template arguments
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 14 07:06:18 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7110
Denis <verylonglogin.reg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |
Summary|static opSlice & opIndex |opSlice() & opIndex
|functions don't work as |functions works unstable as
|template arguments |template arguments
--- Comment #3 from Denis <verylonglogin.reg at gmail.com> 2011-12-14 18:06:17 MSK ---
And an easier workaround:
---
alias Template!((Call[])) A3; // passes
alias Template!((Call[0])) A4; // passes
---
But isn't it strange? Looks like this workaround is a bug. It leads to things
like this:
---
struct S
{
int opSlice(int, int) const { return 0; }
int opSlice() const { return 0; }
int opIndex(int, int) const { return 0; }
int opIndex(int) const { return 0; }
}
enum e = S();
template T(alias a) { } // or T(a...)
alias T!( S ) T0; // passes
alias T!((S)) T1; // passes
alias T!( S()[0..0] ) A0; // passes
alias T!( (e[0..0]) ) A1; // passes
alias T!( e[0..0] ) A2; // passes
alias T!( S()[0, 0] ) B0; // passes
alias T!( (e[0, 0]) ) B1; // passes
alias T!( e[0, 0] ) B2; // passes
alias T!( S()[] ) C0; // passes
alias T!( (e[]) ) C1; // passes
alias T!( e[] ) C2; // fails: e is used as a type
alias T!( S()[0] ) D0; // passes
alias T!( (e[0]) ) D1; // passes
alias T!( e[0] ) D2; // fails: e must be an array or pointer type, not S
---
And the last error message looks wrong.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list