Skip to content

Fix bit shifts with bit literals on lhs #2450

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

Merged

Conversation

orpuente-MS
Copy link
Contributor

The following program was failing to compile because the 1 on the lhs of the << expression was being lowered as an int, and the qasm spec does not define bit shifts for ints. The fix consists in lowering the literal as a uint instead, which is allowed by the spec.

const int a = 1 << 5;
def const_evaluation_context() {
    int b = a;
}

@orpuente-MS orpuente-MS added this pull request to the merge queue May 22, 2025
@orpuente-MS orpuente-MS removed this pull request from the merge queue due to a manual request May 22, 2025
@orpuente-MS orpuente-MS added this pull request to the merge queue May 22, 2025
Merged via the queue into main with commit d029c47 May 22, 2025
18 checks passed
@orpuente-MS orpuente-MS deleted the oscarpuente/fix-bit-shifts-with-int-literal-on-lhs branch May 22, 2025 21:58
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.

2 participants