-
Notifications
You must be signed in to change notification settings - Fork 144
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
Try improving the compiler error messages when calling cudaq::sample
with incorrect kernel arguments
#827
base: main
Are you sure you want to change the base?
Conversation
…with incorrect kernel arguments Although C++ concept much better error messages, it seems to be not as user-friendly as we want. e.g., see https://gist.github.com/anthony-santana/d394888ad14853fe5825a59bd4d518f5 This PR attempted to address that: - Provide a 'catching' match (when the expected `ValidArgumentsPassed` failed) in order to customize the error message (via static_assert message). - Construct the error message via compile-time (constexpr) code.
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
I wonder if we can't use the concept framework, perhaps with some more descriptive names, to our advantage here. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
I think we adopted For example, the compiler error message shown in the snippet did refer to the concept Until a new C++ feature similar to this one becomes available, I think we'd need to do something like this PR to further customize the compiler error messages. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Description
Although C++
concept
generates much better error messages, it seems to be not as user-friendly as we want.e.g., see https://gist.github.com/anthony-santana/d394888ad14853fe5825a59bd4d518f5
This PR attempted to address that:
Provide a 'catching' match (when the expected
ValidArgumentsPassed
failed) in order to customize the error message (via astatic_assert
message).Construct the error message via compile-time (
constexpr
) code.The error message will look like
static assertion failed due to requirement 'InvalidArgs<cudaq::Msg<25>{"requires <double>, got <>"}>'
.