Sorry, not using arch linux. Browsed just now, archlinux has cuda 11.5.0-1 in packages.
Also I think you can install cudatoolkit, which has cuda as dependency. Either directly, or using conda.
6 hours for yay is crazy, seems like you were installing from source,
You can also download cuda specific version from here: Index of /archive/packages/c/cuda/ 3 or here: Index of /packages/c/cuda/ 1 and install using 'sudo pacman -U filename ’
Error you mentioned is a generic compiler error, we won’t be able to find the reason this way.