atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
231 stars 31 forks source link

enum inside a struct should be referred to by its full name outside the struct #119

Closed Laeeth closed 5 years ago

atilaneves commented 5 years ago

It already is:

                struct Struct {
                    enum Enum { foo, bar, baz };
                };

Currently translates to:

struct Struct
    {
        static enum Enum
        {
            foo = 0,
            bar = 1,
            baz = 2,
        }
        enum foo = Enum.foo;
        enum bar = Enum.bar;
        enum baz = Enum.baz;
    }
Laeeth commented 5 years ago

No the translation of code outside the struct.

eg boolCheckType(Struct s, Struct.Enum e)

Some cpp code gets rendered as just Enum e

atilaneves commented 5 years ago

That's fine: the idea is to emulate the behaviour one would get from C or C++. There, enums (but not class enums in C++ post 11) pollute the global namespace.

Laeeth commented 5 years ago

Yes, but right now dpp breaks class enums and I wish that it would not.

atilaneves commented 5 years ago

Yes, but right now dpp breaks class enums and I wish that it would not.

Ah. That's a different story. I also realise I didn't understand correctly your example with boolCheckType above.

Laeeth commented 5 years ago

You're a bit quick to close or dismiss issues!