Skip to content

[BUG]: barrier tests fail to compile w/ clang: #6255

@Artem-B

Description

@Artem-B

Is this a duplicate?

Type of Bug

Compile-time Error

Component

libcu++

Describe the bug

A handful of barrier tests fail to build with clang due to their attempts to use bit_cast<barrier> which fails to compile because barrier is not trivially copyable.

https://godbolt.org/z/M6qjz1hsh

E.g:

#if _CCCL_CUDA_COMPILER(CLANG)
__shared__ char barrier_data[sizeof(barrier)];
barrier& bar = cuda::std::bit_cast<barrier>(barrier_data);
#else // ^^^ _CCCL_CUDA_COMPILER(CLANG) ^^^ / vvv !_CCCL_CUDA_COMPILER(CLANG)
__shared__ barrier bar;

<source>:16:18: error: no matching function for call to 'bit_cast'
   16 |   barrier& bar = cuda::std::bit_cast<barrier>(barrier_data);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/cccl/trunk/libcudacxx/include/cuda/std/__bit/bit_cast.h:52:61: note: candidate template ignored: requirement 'is_trivially_copyable_v<cuda::barrier<cuda::std::thread_scope_block, cuda::std::__empty_completion>> || __is_extended_floating_point_v<cuda::barrier<cuda::std::thread_scope_block, cuda::std::__empty_completion>>' was not satisfied [with _To = barrier, _From = char[8], $2 = 0]
   52 | [[nodiscard]] _CCCL_API inline _CCCL_CONSTEXPR_BIT_CAST _To bit_cast(const _From& __from) noexcept

How to Reproduce

https://godbolt.org/z/M6qjz1hsh

Expected behavior

Test should be compileable.

Reproduction link

https://godbolt.org/z/M6qjz1hsh

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working right.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions