-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix #140: On enums and scope. #145
Conversation
dstep/Configuration.d
Outdated
@@ -53,6 +53,10 @@ struct Configuration | |||
@("reduce-aliases", "Reduce primitive type aliases [default].") | |||
bool reduceAliases = true; | |||
|
|||
/// generate aliases for enum items in global scope | |||
@("alias-enum-items", "Generate aliases for enum items in global scope [default].") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
items
-> members
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed.
unit_tests/EnumUnitTests.d
Outdated
@@ -216,6 +216,38 @@ D"); | |||
|
|||
} | |||
|
|||
// Test aliasing of all enum items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sigh...
Extended the commit message as well.
…ep to generate aliases for enum members.
👌. |
Could you please create a PR that updates the changelog with the PRs I just merged. I merged them a bit too quickly 😃. |
Sure. |
I just noticed that the following code: struct Foo
{
enum Bar
{
asd
};
}; Incorrectly translates, with the new extern (C):
struct Foo
{
enum Bar
{
asd = 0
}
}
alias asd = Bar.asd; The alias should be placed in the parent scope not the global scope. |
Here's a better example which gives no warnings: struct Foo
{
enum Bar
{
asd
} bar;
}; |
The alias should be placed in the parent scope not the global scope. No, in C enums are exported to global scope. e.g.
This compiles fine and prints 1. Anyway it should be |
Ah, I was running the C++ compiler, not the C compiler. My bad. |
As is the title.