digitalmars.D.bugs - _arguments in constructor
- Fredrik Olsson <peylow gmail.com> Jan 25 2006
- Dave <Dave_member pathlink.com> Jan 25 2006
- Fredrik Olsson <peylow treyst.se> Jan 26 2006
This example should not assert I believe:
===
module main;
class Foo {
uint args;
this(...) {
args = _arguments.length;
foreach(TypeInfo typeInfo; _arguments) {
typeInfo.print();
}
}
}
int main(char[][] args) {
auto foo = new Foo(1, 2, 3);
assert(foo.args == 3);
return 0;
}
===
I compile with GDC 0.17, om Mac OS X 10.4.4.
The output is:
TypeInfo[]
int
int
int
So it seams that the hidden variable _arguments is included in itself
for constructors.
// Fredrik Olsson
Jan 25 2006
Works fine (doesn't assert) w/ dmd v0.144 on either/both WinXP and Linux. In article <dr8js8$2g3j$1 digitaldaemon.com>, Fredrik Olsson says...This example should not assert I believe: === module main; class Foo { uint args; this(...) { args = _arguments.length; foreach(TypeInfo typeInfo; _arguments) { typeInfo.print(); } } } int main(char[][] args) { auto foo = new Foo(1, 2, 3); assert(foo.args == 3); return 0; } === I compile with GDC 0.17, om Mac OS X 10.4.4. The output is: TypeInfo[] int int int So it seams that the hidden variable _arguments is included in itself for constructors. // Fredrik Olsson
Jan 25 2006
Dave skrev:Works fine (doesn't assert) w/ dmd v0.144 on either/both WinXP and Linux.
So then it is a GDC specific (or perhaps even OS X specific) bug, I better repost it in D.gnu for safe measure. // Fredrik OlssonIn article <dr8js8$2g3j$1 digitaldaemon.com>, Fredrik Olsson says...This example should not assert I believe: === module main; class Foo { uint args; this(...) { args = _arguments.length; foreach(TypeInfo typeInfo; _arguments) { typeInfo.print(); } } } int main(char[][] args) { auto foo = new Foo(1, 2, 3); assert(foo.args == 3); return 0; } === I compile with GDC 0.17, om Mac OS X 10.4.4. The output is: TypeInfo[] int int int So it seams that the hidden variable _arguments is included in itself for constructors. // Fredrik Olsson
Jan 26 2006








Fredrik Olsson <peylow treyst.se>