Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In C an enumerator has type
int, so a shift by one takes the "already the correct type" case inVisitBinaryOperatorand is written bare. The generator emits the enumerator as a member of its C# enum, though, and C# cannot shift by an enum:In C++ the enumerator has the enum's type and already falls through to the
(int)(...)fallback, so only C is affected. This adds a case ahead of theintcase that casts when the shift count, as written (ignoring parentheses and implicit casts), is a reference to an enumerator. The newEnumConstantBitshiftTestsits next toUnsignedIntBitshiftTestfrom #611 and covers a constant and a macro, each with and without parentheses; it fails without the change (FlagA = 1U << BIT_A;).Found while generating bindings for Linux's
io_uring.h, whoseIOSQE_*flags are defined as(1U << IOSQE_*_BIT).Testing: the full
ClangSharp.PInvokeGenerator.UnitTestssuite passes on Windows. WithRUN_ALL_VARIANTS=1the only failures are 16 inWideStringLiteralConstTestandWideStringLiteralStaticConstTest, which fail the same way onmainwhen the Unix variants run on a Windows host.🤖 Generated with Claude Code