Using cuda::std::complex <<, >> (ostream,istream) operators cause to compilation error

when updated from cuda 12. to cuda 12.5 and using cuda::std::complex <<, >> (ostream,istream) operator cause to compilation error.

My system
OS: rocky linux 9
Cuda version 12.5
C++ compiler clang or gcc11
The toy code to stimulate the issue is:

#include <iostream>
#include <cuda/std/complex>
int main()
{
  using Complex = cuda::std::complex<float>;
  Complex a(1,2);
  std::cout<<a;
  return 0;
}

The compilation error are:

home/Yehonatans/CLionProjects/ComplexJitLtoProject/main.cu(9): error: no operator "<<" matches these operands
            operand types are: std::ostream << Complex
    std::cout<<a;
             ^
/usr/include/c++/11/ostream(283): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type *) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(__streambuf_type* __sb);
        ^
/usr/include/c++/11/ostream(250): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(nullptr_t)
        ^
/usr/include/c++/11/ostream(245): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(const void *) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(const void* __p)
        ^
/usr/include/c++/11/ostream(232): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(long double __f)
        ^
/usr/include/c++/11/ostream(224): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(float __f)
        ^
/usr/include/c++/11/ostream(220): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(double __f)
        ^
/usr/include/c++/11/ostream(205): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned long long) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(unsigned long long __n)
        ^
/usr/include/c++/11/ostream(201): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(long long) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(long long __n)
        ^
/usr/include/c++/11/ostream(192): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(unsigned int __n)
        ^
/usr/include/c++/11/ostream(189): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(int __n);
        ^
/usr/include/c++/11/ostream(181): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned short) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(unsigned short __n)
        ^
/usr/include/c++/11/ostream(178): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(short) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(short __n);
        ^
/usr/include/c++/11/ostream(174): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(bool __n)
        ^
/usr/include/c++/11/ostream(170): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(unsigned long) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(unsigned long __n)
        ^
/usr/include/c++/11/ostream(166): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(long) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(long __n)
        ^
/usr/include/c++/11/ostream(127): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base &(*)(std::ios_base &)) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(ios_base& (*__pf) (ios_base&))
        ^
/usr/include/c++/11/ostream(117): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type &(*)(std::basic_ostream<_CharT, _Traits>::__ios_type &)) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(__ios_type& (*__pf)(__ios_type&))
        ^
/usr/include/c++/11/ostream(108): note #3326-D: function "std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type &(*)(std::basic_ostream<_CharT, _Traits>::__ostream_type &)) [with _CharT=char, _Traits=std::char_traits<char>]" does not match because argument #1 does not match parameter
        operator<<(__ostream_type& (*__pf)(__ostream_type&))
        ^
/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/cuda/12.5/include/cuda/std/detail/libcxx/include/__type_traits/../cstddef(150): note #3326-D: function template "cuda::std::operator<<" does not match because argument #1 does not match parameter
    operator<< (byte __lhs, _Integer __shift) noexcept
    ^
/usr/include/c++/11/cstddef(126): note #3326-D: function template "std::operator<<(std::byte, _IntegerType) noexcept" does not match because argument #1 does not match parameter
      operator<<(byte __b, _IntegerType __shift) noexcept
      ^
/usr/include/c++/11/complex(555): note #3327-D: candidate function template "std::operator<<(std::basic_ostream<_CharT, _Traits> &, const std::complex<_Tp> &)" failed deduction
      operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
      ^
/usr/include/c++/11/ostream(750): note #3327-D: candidate function template "std::operator<<(_Ostream &&, const _Tp &)" failed deduction
      operator<<(_Ostream&& __os, const _Tp& __x)
      ^
/usr/include/c++/11/ostream(629): note #3326-D: function template "std::operator<<(std::basic_ostream<char, _Traits> &, const unsigned char *)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
      ^
/usr/include/c++/11/ostream(624): note #3326-D: function template "std::operator<<(std::basic_ostream<char, _Traits> &, const signed char *)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
      ^
/usr/include/c++/11/ostream(611): note #3326-D: function template "std::operator<<(std::basic_ostream<char, _Traits> &, const char *)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
      ^
/usr/include/c++/11/bits/ostream.tcc(321): note #3326-D: function template "std::operator<<(std::basic_ostream<_CharT, _Traits> &, const char *)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
      ^
/usr/include/c++/11/ostream(594): note #3327-D: candidate function template "std::operator<<(std::basic_ostream<_CharT, _Traits> &, const _CharT *)" failed deduction
      operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
      ^
/usr/include/c++/11/ostream(535): note #3326-D: function template "std::operator<<(std::basic_ostream<char, _Traits> &, unsigned char)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
      ^
/usr/include/c++/11/ostream(530): note #3326-D: function template "std::operator<<(std::basic_ostream<char, _Traits> &, signed char)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
      ^
/usr/include/c++/11/ostream(524): note #3326-D: function template "std::operator<<(std::basic_ostream<char, _Traits> &, char)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<char, _Traits>& __out, char __c)
      ^
/usr/include/c++/11/ostream(518): note #3326-D: function template "std::operator<<(std::basic_ostream<_CharT, _Traits> &, char)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
      ^
/usr/include/c++/11/ostream(513): note #3327-D: candidate function template "std::operator<<(std::basic_ostream<_CharT, _Traits> &, _CharT)" failed deduction
      operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
      ^
/usr/include/c++/11/system_error(279): note #3326-D: function template "std::operator<<(std::basic_ostream<_CharT, _Traits> &, const std::error_code &)" does not match because argument #2 does not match parameter
      operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
      ^
/usr/include/c++/11/bits/basic_string.h(6531): note #3327-D: candidate function template "std::operator<<(std::basic_ostream<_CharT, _Traits> &, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc> &)" failed deduction
      operator<<(basic_ostream<_CharT, _Traits>& __os,
      ^
/usr/include/c++/11/string_view(670): note #3327-D: candidate function template "std::operator<<(std::basic_ostream<_CharT, _Traits> &, std::basic_string_view<_CharT, _Traits>)" failed deduction
      operator<<(basic_ostream<_CharT, _Traits>& __os,
      ^
/usr/include/c++/11/system_error(206): note #3328-D: built-in operator<<(<promoted integral>, <promoted integral>) does not match because argument #1 does not match parameter
        enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type>

``

I can confirm that it compiles successfully on CUDA 12.4.1 (but not 12.5.1)

Suggestion: retest with the latest available CUDA, currently 12.6.1. if it still fails to compile, file a bug, or you could file a CCCL issue. Ah, it looks like you already did.