Skip to content

Cast to const user-defined (pointer) types in macro expressions#261

Open
cbecerescu wants to merge 1 commit intoatilaneves:masterfrom
cbecerescu:macro_struct_cast
Open

Cast to const user-defined (pointer) types in macro expressions#261
cbecerescu wants to merge 1 commit intoatilaneves:masterfrom
cbecerescu:macro_struct_cast

Conversation

@cbecerescu
Copy link
Copy Markdown
Contributor

No description provided.

&& isType(tokens[1..$])
&& ((tokens[0] == Token(Token.Kind.Keyword, "const")
&& isType(tokens[1..$]))
|| (tokens[$-1] == Token(Token.Kind.Keyword, "const")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sure that we treat all the cases with const + pointers, and view them as casts.

However, DPP does not currently translate the C cast within a macro. So that means that "(struct foo const *)" or "(struct foo * const)" are not going to be translated to valid D types (although now they are at least going to be seen as casts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant