Bug: Standard library headers included inside module purview of `winrt_numerics.ixx`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cpp
- Lĩnh vực
- build-system
Hướng nghiên cứu
Start with winrt_numerics.ixx and windowsnumerics.impl.h, then inspect the WindowsNumerics.inl includes in the Windows SDK and the mingw-w64 headers named in the report. Reproduce the module build with GCC or Clang and compare it with MSVC. Done when required standard headers are included in the global module fragment and the DirectX interop functions are exported, with the reported module conflicts resolved.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
3.0.260818.1
Summary
In C++20 module builds (-modules), winrt_numerics.ixx only pre-includes <directxmath.h> in its global module fragment before declaring export module winrt_numerics; and including <windowsnumerics.impl.h> inside the module purview.
However, <windowsnumerics.impl.h> transitively includes standard library headers (<stdexcept> and <limits> via WindowsNumerics.inl in the Windows SDK, and <algorithm> and <cmath> in mingw-w64). Because those headers are not pre-included in the global module fragment, they are expanded directly inside the purview of winrt_numerics:
- GCC (libstdc++) and Clang (libc++) attach those standard library declarations to the named module
winrt_numerics, conflicting with earlier global module declarations from<version>and causingwinrt_numerics.ixxto fail to compile. - MSVC masks this only because its standard library headers wrap
namespace stdinextern "C++", andwinrt_numerics.ixxsuppresses warning'#include <stdexcept>' in the purview of module 'winrt_numerics' appears erroneouswith#pragma warning(disable : 5244).
In addition, the DirectX interop functions (XMLoadFloat2, XMStoreFloat2, etc.) in <windowsnumerics.impl.h> are declared outside _WINDOWS_NUMERICS_BEGIN_NAMESPACE_, leaving them unexported and attached to winrt_numerics even on MSVC.
Reproducible example
$out = Join-Path $env:TEMP "cppwinrt_numerics_repro"
Remove-Item -Recurse -Force $out -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $out | Out-Null
Push-Location $out
# 1. Generate module projection with cppwinrt 3.0.260818.1
$cppwinrt = "$env:USERPROFILE\.nuget\packages\microsoft.windows.cppwinrt\3.0.260818.1\bin\cppwinrt.exe"
& $cppwinrt -in local -out $out -modules -include Windows.Foundation
# 2. MSVC: succeeds because warning C5244 is suppressed and MSVC STL uses extern "C++"
$vsDevCmd = "C:\Program Files\Microsoft Visual Studio\18\Community\Common7\Tools\VsDevCmd.bat"
$msvcCmds = @(
"`"$vsDevCmd`" -arch=x64 -no_logo"
"cd /d `"$out`""
"cl /nologo /std:c++20 /EHsc /MD /I. /c /interface /TP winrt/winrt_numerics.ixx /ifcOutput winrt_numerics.ifc"
) -join " && "
cmd /c $msvcCmds
# 3. GCC: fails when compiling winrt/winrt_numerics.ixx directly
g++ -std=c++20 -fmodules -I. -x c++ -c winrt/winrt_numerics.ixx -o winrt_numerics.o
Pop-Location
MSVC output:
winrt_numerics.ixx
GCC output when compiling winrt/winrt_numerics.ixx:
In file included from C:/Tools/msys64/ucrt64/include/c++/16.2.0/bits/stl_algobase.h:63,
from C:/Tools/msys64/ucrt64/include/c++/16.2.0/algorithm:62,
from C:/Tools/msys64/ucrt64/include/windowsnumerics.impl.h:28,
from winrt/winrt_numerics.ixx:48:
C:/Tools/msys64/ucrt64/include/c++/16.2.0/bits/stl_pair.h:102:12: error: conflicting declaration of 'struct std::_Index_tuple<_Indexes>' in module 'winrt_numerics'
102 | struct _Index_tuple;
| ^~~~~~~~~~~~
In file included from C:/Tools/msys64/ucrt64/include/c++/16.2.0/bits/cpp_type_traits.h:42,
from C:/Tools/msys64/ucrt64/include/c++/16.2.0/bits/stl_algobase.h:60:
C:/Tools/msys64/ucrt64/include/c++/16.2.0/type_traits:4372:39: note: previously declared in global module
4372 | template<size_t... _Indexes> struct _Index_tuple { };
| ^~~~~~~~~~~~
In file included from C:/Tools/msys64/ucrt64/include/c++/16.2.0/cmath:55,
from C:/Tools/msys64/ucrt64/include/windowsnumerics.impl.h:29:
C:/Tools/msys64/ucrt64/include/math.h:150:10: error: conflicting declaration of 'struct _exception' in global module
150 | struct _exception {
| ^~~~~~~~~~
C:/Tools/msys64/ucrt64/include/math.h:15:8: note: previously declared in module 'winrt_numerics'
15 | struct _exception;
| ^~~~~~~~~~
Expected behavior
Pre-include the standard library headers required by <windowsnumerics.impl.h> in the global module fragment of winrt_numerics.ixx (or import std; before including <windowsnumerics.impl.h>), and ensure the DirectX interop functions in <windowsnumerics.impl.h> are also exported with WINRT_EXPORT.
Actual behavior
No response
Additional comments
No response
- Ngôn ngữ chính
- C++
- Star
- 1.9k
- Fork
- 288
- Merge trung bình
- 18 giờ 15 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/cppwinrt
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/cppwinrt#1646 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/cppwinrt#1554 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: Unexported `extern "C"` block in `base.h` makes `WINRT_IMPL_*` declarations invisible to downstream modulesCó thể đã có người làm @YexuanXiao đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
microsoft/cppwinrt#1643 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
base_macros.h disables warnings without push/pop, leaking them into consumer translation unitsCó thể đã có người làm @DanielJump đã nhận 64 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 20/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: headers cannot be compiled at high warning levels (MSVC /Wall, clang)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
microsoft/cppwinrt#1620 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/cppwinrt
Issue tương tự
-
Linux npm packaging leaves workspace files that block subsequent CI checkoutCó thể đã có người làm @Spockkk0225 đã nhận hôm nay. Đang mởci
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
alibaba/neug#1195 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
SCIInstitute/SCIRun#2909 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area: packaging blocked dependencies P3: low post-stable value: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
patrick-hudson/put.gd-desktop#1210 ·
Maintainer thường phản hồi trong vòng 1 ngày