www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - mixin and const initializer

reply "Ilya Zaitseff" <sark7 mail333.com> writes:
<code>
template T()
{
   int x;
}

struct S
{
   mixin T;
}

void main()
{
   const S s = { x:0 };
}
</code>

When compiling, DMD 0.113 outputs:
Error: 'x' is not a member of 'S'

But if remove 'mixin T' line, and insert instead 'int x', program compiles  
successfully.
Feb 22 2005
parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ilya Zaitseff wrote:
| <code>
| template T()
| {
|   int x;
| }
|
| struct S
| {
|   mixin T;
| }
|
| void main()
| {
|   const S s = { x:0 };
| }
| </code>
|
| When compiling, DMD 0.113 outputs:
| Error: 'x' is not a member of 'S'
|
| But if remove 'mixin T' line, and insert instead 'int x', program
| compiles  successfully.

Added to DStress as
http://dstress.kuehne.cn/run/mixin_05.d
http://dstress.kuehne.cn/run/mixin_06.d

Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCMicy3w+/yD4P9tIRAu1iAJwLviiEvUfk1oufKbR8NRCD4GEfJwCdGnbQ
jN5ISBTgjFLfXfrkI5l1xjg=
=6Dus
-----END PGP SIGNATURE-----
Mar 11 2005