Skip to content

|libc++] Compilation errors when compiling libc++ std module on windows #64810

Closed
@Arthapz

Description

@Arthapz

Hello, i'm getting a weird error with clang and libc++ std module on windows (using ucrt)

C:\Dev\llvm\include\c++\v1\__expected\expected.h:84:29: error: missing '#include <__expected/expected.h>'; '_Err' must be declared before it is used
   84 |   throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
      |                             ^
C:\Dev\llvm\include\c++\v1\__expected\expected.h:81:17: note: declaration here is not visible
   81 | template <class _Err, class _Arg>
      |                 ^
C:\Dev\llvm\include\c++\v1\__expected\expected.h:84:48: error: missing '#include <__expected/expected.h>'; '_Arg' must be declared before it is used
   84 |   throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
      |                                                ^
C:\Dev\llvm\include\c++\v1\__expected\expected.h:81:29: note: declaration here is not visible
   81 | template <class _Err, class _Arg>
      |                             ^
C:\Dev\llvm\include\c++\v1\__expected\expected.h:84:54: error: missing '#include <__expected/expected.h>'; '__arg' must be declared before it is used
   84 |   throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
      |                                                      ^
C:\Dev\llvm\include\c++\v1\__expected\expected.h:82:63: note: declaration here is not visible
   82 | _LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {

here a self contained reproducer with full logs: https://github.com/Arthapz/libc--error-expected

> clang --version                                                                                                                                                                                                 18:58:30  
clang version 18.0.0 (https://github.com/llvm/llvm-project.git ef82a53bbb89e831bb524d1b8a60458abb86ce99)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Dev\llvm\bin

we can also reproduce this with std::print (juste a std::print + import std; in main function produce same errors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:modulesC++20 modules and Clang Header Moduleslibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.platform:windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions