Adjointing a forward-declared __qpu__ function crashes with an assertion failure rather than emitting a diagnostic.
Reproduction
prep.cpp:
#include <cudaq.h>
__qpu__ void prep(cudaq::qubit &q) { h(q); }
main.cpp:
#include <cudaq.h>
__qpu__ void prep(cudaq::qubit &q);
__qpu__ bool kernel() {
cudaq::qubit q;
cudaq::adjoint(prep, q);
return mz(q);
}
int main() {}
nvq++ -c prep.cpp -o prep.o
nvq++ -c main.cpp # crashes
Expected: a compiler error saying the kernel body is unavailable, or a trap generated in lieu of an adjointed kernel.
Actual:
Assertion `!NodePtr->isKnownSentinel()' failed.
...
ApplySpecializationPass::createAdjointVariantOf
ApplyOpSpecialization.cpp:588
Adjointing a forward-declared
__qpu__function crashes with an assertion failure rather than emitting a diagnostic.Reproduction
prep.cpp:
main.cpp:
nvq++ -c prep.cpp -o prep.o nvq++ -c main.cpp # crashesExpected: a compiler error saying the kernel body is unavailable, or a trap generated in lieu of an adjointed kernel.
Actual: