Skip to content

Unable to use "native" inside of class but outside of function #168

@s014c3

Description

@s014c3

As title says, this is invalid code, which I would consider a bug

class Test {
    native {}
}

Use case for this: injecting language-specific features

Example:

class Test {
    #if D
    native { @property }
    #endif
    int getval() 
    #if D
    native { @nogc @safe nothrow }
    #endif
        { return 2; } 
}

Which would generate following D code

class Test {
     @property
    int getval()
     @nogc @safe nothrow
        { return 2; }
}

But is unable to do so as of right now

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions