-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Description
When a QuantumMeasurementStatement is inside a box block, pyqasm cannot find the classical register that was declared in the outer scope.
Reproduction
from pyqasm import loads
qasm = """
OPENQASM 3.0;
include "stdgates.inc";
qubit[2] q;
bit[2] c;
box {
h q[0];
c[0] = measure q[0];
}
"""
m = loads(qasm)
m.unroll()
# Error: Missing clbit register declaration for 'c' in QuantumMeasurementStatementExpected Behavior
The measurement inside the box should be able to reference the classical register c declared in the outer scope, since QASM 3 box blocks inherit the enclosing scope.
Actual Behavior
Error at line 5, column 14 in QASM file
>>>>>> c[0] = measure q[0];
Missing clbit register declaration for 'c' in QuantumMeasurementStatement
Notes
Qubit registers declared in the outer scope ARE accessible from within boxes (e.g., h q[0] works). Only classical register lookups fail.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels