Cuda 12.1 - Error when building cuda samples

I installed Cudatoolkit 12.1 on laptop with Ubuntu 22.04. The GPU is the mobile RTX 3080, CPU is AMD 5900HX. GCC version is 12.2.

The install went fine and it mostly seems to be working fine. I decided to compile all the cuda samples and got this error -

>>> GCC Version is greater or equal to  5.1.0 <<<
/usr/local/cuda/bin/nvcc -ccbin g++ -I../../../Common -m64 --std=c++11 --threads 0 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_89,code=sm_89 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o simpleAWBarrier.o -c simpleAWBarrier.cu
/usr/local/cuda/bin/../targets/x86_64-linux/include/cuda/std/barrier(144): error: function "operator new" cannot be called with the given argument list
            argument types are: (unsigned long, cuda::std::__4::__barrier_base<cuda::std::__4::__empty_completion, 2> *)
         new (&__b->__barrier) __barrier_base(__expected); 
         ^

1 error detected in the compilation of "simpleAWBarrier.cu".
make: *** [Makefile:361: simpleAWBarrier.o] Error 255

The error doesn’t seem to be in the sample program but a standard include from the toolkit.