Skip to content

[BUG]: Assertion compilation fail on Visual Studio clang #6970

@asmelko

Description

@asmelko

Is this a duplicate?

Type of Bug

Compile-time Error

Component

General CCCL

Describe the bug

Attempting to compile a simple CCCL file in debug mode with Visual Studio Clang fails with undeclared identifier '__assert_fail'.

In file included from test/main.cpp:1:
In file included from C:/Users/asmelko/Desktop/PhysiCore/build/llvm-debug/vcpkg_installed/x64-windows/include/cccl\cuda/std/span:54:
In file included from C:/Users/asmelko/Desktop/PhysiCore/build/llvm-debug/vcpkg_installed/x64-windows/include/cccl\cuda/std/array:42:
C:/Users/asmelko/Desktop/PhysiCore/build/llvm-debug/vcpkg_installed/x64-windows/include/cccl\cuda/std/__utility/unreachable.h:29:3: error: use of undeclared identifier '__assert_fail'
   29 |   _CCCL_ASSERT(false, "unreachable");
      |   ^
C:/Users/asmelko/Desktop/PhysiCore/build/llvm-debug/vcpkg_installed/x64-windows/include/cccl\cuda/std/__cccl/assert.h:147:45: note: expanded from macro '_CCCL_ASSERT'
  147 | #  define _CCCL_ASSERT(expression, message) _CCCL_ASSERT_HOST(expression, message)
      |                                             ^
C:/Users/asmelko/Desktop/PhysiCore/build/llvm-debug/vcpkg_installed/x64-windows/include/cccl\cuda/std/__cccl/assert.h:115:50: note: expanded from macro '_CCCL_ASSERT_HOST'
  115 | #  define _CCCL_ASSERT_HOST(expression, message) _CCCL_ASSERT_IMPL_HOST(expression, message)
      |                                                  ^
C:/Users/asmelko/Desktop/PhysiCore/build/llvm-debug/vcpkg_installed/x64-windows/include/cccl\cuda/std/__cccl/assert.h:86:18: note: expanded from macro '_CCCL_ASSERT_IMPL_HOST'
   86 |     ? (void) 0 : __assert_fail(message, __FILE__, __LINE__, __func__)
      |                  ^

How to Reproduce

  1. Create a file main.cpp with the following contents:
#include <cuda/std/span>
int main() { return 0; }
  1. Compile debug with Visual Studio clang:
clang -I<cccl include dir> -std=c++20 -DCCCL_ENABLE_ASSERTIONS -DTBB_USE_DEBUG main.cpp

Expected behavior

The aforementioned file should compile.

Reproduction link

No response

Operating System

Windows 11

nvidia-smi output

No response

NVCC version

clang --version
clang version 19.1.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin

Also, running on Visual Studio Community Edition 2022, 17.14.22

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working right.needs triageIssues that require the team's attention

    Type

    No type

    Projects

    Status

    In Review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions