Hello, I'm using DMD32 D Compiler v2.060 for on Windows.


module main;

import std.stdio;

int main(string[] argv)
{
        writeln(TestStruct.x.offsetof);
        TestClass.test1();
        TestClass var = new TestClass();
        var.test2();
        return 0;
}

class TestClass
{
        static void test1()
        {
                writeln(TestStruct.x.offsetof);
        }

        void test2()
        {
                writeln(TestStruct.x.offsetof);//bug here
        }
}

struct TestStruct
{
        int x;
}

While test1 gives me no issues, test2 causes the following error:

Error: this for x needs to be type TestStruct not type main.TestClass


Is this a known bug? How can I work around this issue in order to use offsetof from a class function that is not static?

Thanks

Reply via email to