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

ConstantsScraper: Using --with-type with a constant that has a shift produces bad code #1861

Open
dpaoliello opened this issue Feb 29, 2024 · 0 comments

Comments

@dpaoliello
Copy link
Contributor

Given a constant that is calculated with a shift:

#define MY_CONST (1<<4)

Then trying to use --with-type with this constant (e.g., --with-type=MY_CONST=ushort), constants scraper will produce the following code:

public const ushort MY_CONST = 1u<<4;

Which is invalid:

error CS0266: Cannot implicitly convert type 'uint' to 'ushort'. An explicit conversion exists (are you missing a cast?)
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

No branches or pull requests

1 participant