Yes, and the way you do it is exactly what you are showing.
The reason it is not working is because in your test case, the warning is not emitted by gcc. In this case, the warning is being emitted by cicc, which is a NVIDIA sub-tool within nvcc:
(you can discover this with --verbose)
By the time the processed version of this host code actually makes it to the host compiler, the item that triggered the warning seems to be gone, perhaps removed by cicc.
I’m not aware of any documented method to instruct cicc to convert warnings to errors. Simple things like -Xcicc -Werror did not work.
If you’d like to have this capability, you may wish to file a bug at developer.nvidia.com. The instructions are linked to a sticky post at the top of the CUDA programming sub-forum.