Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enum template as template parameter #1

Open
belka-ew opened this issue Dec 9, 2016 · 0 comments
Open

enum template as template parameter #1

belka-ew opened this issue Dec 9, 2016 · 0 comments
Labels

Comments

@belka-ew
Copy link
Contributor

belka-ew commented Dec 9, 2016

The following code fails with

Error: template stuff.TestEnum(string name) is used as a type

template TestEnum(string name)
{
    enum TestEnum : bool
    {
        yes = true
    }
}

struct TestStruct(TestEnum!"str" str)
{
}

class TestClass
{
    @Read
    TestStruct!(TestEnum!"str".yes) flags1_;

    mixin(GenerateFieldAccessors);
}

It happens because neither .stringof nor std.traits.fullyQualifiedName retrive the exact type. So

typeof(__traits(getMember, typeof(this), "flags1_")).stringof

is translated into TestStruct!cast(TestEnum)true, but the right type representation should be:
TestStruct!(cast(TestEnum!"str")true)

@belka-ew belka-ew added the bug label Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant