Expected behavior
No additional classical registers are created when measure_all=False when calling qml.to_openqasm.
Actual behavior
Classical registers are created/added to the QASM code.
Additional information
Out of curiosity, why is altering the users program the default? I'd expect the user to have to signal that they want to add measurements.
Source code
import pennylane as qml
dev = qml.device("default.qubit", wires=2)
@qml.qnode(dev)
def bell_state():
qml.Hadamard(wires=0)
qml.CNOT(wires=[0, 1])
return 0
print(qml.to_openqasm(bell_state, measure_all=False)())
>>> OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0],q[1];
System information
qml.about() actually fails since I'm using pennylane installed via uv (i.e. no pip installed), but I'm on version 0.43.1 and python 3.12.0 on a mac.
Existing GitHub issues