_arguments in constructor
Thomas Kuehne
thomas-dloop at kuehne.cn
Thu Feb 23 23:32:09 PST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Fredrik Olsson schrieb am 2006-01-26:
> Repost from D.bugs, as Dave confirmed that it does not affect dmd 0.144
> on win nor linux. So I guess it goes as a more GDC specific bug.
>
> 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.
Added to DStress as
http://dstress.kuehne.cn/run/v/variadic_argument_12_A.d
http://dstress.kuehne.cn/run/v/variadic_argument_12_B.d
http://dstress.kuehne.cn/run/v/variadic_argument_12_C.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFD/sH53w+/yD4P9tIRAmtWAJ0dIL5KxKHNWRr0MHsVDlptm27YHACgrOMK
fjpk8hg243FKSgx41GYAuSw=
=fY5H
-----END PGP SIGNATURE-----
More information about the D.gnu
mailing list