Thread overview
Scoping bug with offsetof?
Apr 25, 2005
brad beveridge
Apr 25, 2005
Brad Beveridge
Apr 26, 2005
Thomas Kuehne
April 25, 2005
I think I may have found a bug - well it is certainly something :)
The following code causes an error with DMD 0.121 on Linux
The error is
"error.d(12): this for a needs to be type Foo not type Bar *"

This is a regression, the DMD 0.112 (I think?) allowed this code.

Thanks
Brad

<code>
import std.stdio;

struct Foo
{
    float a;
}

struct Bar
{
    void test()
    {
        writefln(Foo.a.offsetof);  // comment this line in/out
    }
}

int main(char[][] arg)
{
    writefln(Foo.a.offsetof);
    return 0;
}
</code>
April 25, 2005
brad beveridge wrote:
> I think I may have found a bug - well it is certainly something :)
> The following code causes an error with DMD 0.121 on Linux
> The error is
> "error.d(12): this for a needs to be type Foo not type Bar *"
> 
> This is a regression, the DMD 0.112 (I think?) allowed this code.
> 
> Thanks
> Brad
> 
> <code>
> import std.stdio;
> 
> struct Foo
> {
>     float a;
> }
> 
> struct Bar
> {
>     void test()
>     {
>         writefln(Foo.a.offsetof);  // comment this line in/out
>     }
> }
> 
> int main(char[][] arg)
> {
>     writefln(Foo.a.offsetof);
>     return 0;
> }
> </code>
Note - this bug also happens with Foo.a.sizeof

Brad
April 26, 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brad Beveridge schrieb am Tue, 26 Apr 2005 11:48:15 +1200:
> brad beveridge wrote:
>> I think I may have found a bug - well it is certainly something :)
>> The following code causes an error with DMD 0.121 on Linux
>> The error is
>> "error.d(12): this for a needs to be type Foo not type Bar *"
>> 
>> This is a regression, the DMD 0.112 (I think?) allowed this code.
>> 
>> Thanks
>> Brad
>> 
>> <code>
>> import std.stdio;
>> 
>> struct Foo
>> {
>>     float a;
>> }
>> 
>> struct Bar
>> {
>>     void test()
>>     {
>>         writefln(Foo.a.offsetof);  // comment this line in/out
>>     }
>> }
>> 
>> int main(char[][] arg)
>> {
>>     writefln(Foo.a.offsetof);
>>     return 0;
>> }
>> </code>
> Note - this bug also happens with Foo.a.sizeof

Added to DStress as http://dstress.kuehne.cn/run/offsetof_78.d http://dstress.kuehne.cn/run/offsetof_79.d http://dstress.kuehne.cn/run/offsetof_80.d http://dstress.kuehne.cn/run/sizeof_13.d http://dstress.kuehne.cn/run/sizeof_14.d http://dstress.kuehne.cn/run/sizeof_15.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFCbivs3w+/yD4P9tIRAgMdAJ0TyLMP20aZsCDMlAkSmtT54EDIBACfUJHW
wElkecIAH8H6Adv2cfCkO48=
=6vFZ
-----END PGP SIGNATURE-----