admin 管理员组文章数量: 1086019
I am trying to build some C++ code in the GitHub CI. This works for GCC and Clang, but compilation with MSVC fails in very weird ways.
The very first error is found at:
template <bool constant, bool nothrow, typename R, typename... Args>
struct Function_Ref_Base {
public:
using Function = R(Args...) noexcept(nothrow);
using Storage = const_if_t<void, constant>;
using Invoker = R(Storage*, Args...) noexcept(nothrow); // <<< error here
... which is:
function_ref.hpp(36,51): error C2065: 'nothrow': undeclared identifier [D:\a\ulight\ulight\build\ulight.vcxproj]
(compiling source file '../src/main/cpp/cpp.cpp')
Complete nonsense. The full compilation command is:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\bin\HostX64\x64\CL.exe
/c /ID:\a\ulight\ulight\include /nologo
/W4 /WX-
/diagnostics:column
/O2 /Ob2
/D _MBCS /D WIN32 /D _WINDOWS /D NDEBUG /D "CMAKE_INTDIR=\"Release\""
/EHsc /MD /GS
/fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline
/std:c++latest
/Fo"ulight.dir\Release\\"
/Fd"D:\a\ulight\ulight\build\Release\ulight.pdb"
/external:W4 /Gd /TP /errorReport:queue
D:\a\ulight\ulight\src\main\cpp\chars.cpp
D:\a\ulight\ulight\src\main\cpp\cpp.cpp
D:\a\ulight\ulight\src\main\cpp\lua.cpp
D:\a\ulight\ulight\src\main\cpp\mmml.cpp
D:\a\ulight\ulight\src\main\cpp\parse_utils.cpp
D:\a\ulight\ulight\src\main\cpp\ulight.cpp
According to CMake's output, the compiler is:
-- Building for: Visual Studio 17 2022
-- The C compiler identification is MSVC 19.43.34808.0
-- The CXX compiler identification is MSVC 19.43.34808.0
This seems more up-to-date than the latest version available on Compiler Explorer. Despite that, I cannot reproduce the issue there.
Why would I get these bogus errors? The full log is at
I am trying to build some C++ code in the GitHub CI. This works for GCC and Clang, but compilation with MSVC fails in very weird ways.
The very first error is found at:
template <bool constant, bool nothrow, typename R, typename... Args>
struct Function_Ref_Base {
public:
using Function = R(Args...) noexcept(nothrow);
using Storage = const_if_t<void, constant>;
using Invoker = R(Storage*, Args...) noexcept(nothrow); // <<< error here
... which is:
function_ref.hpp(36,51): error C2065: 'nothrow': undeclared identifier [D:\a\ulight\ulight\build\ulight.vcxproj]
(compiling source file '../src/main/cpp/cpp.cpp')
Complete nonsense. The full compilation command is:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\bin\HostX64\x64\CL.exe
/c /ID:\a\ulight\ulight\include /nologo
/W4 /WX-
/diagnostics:column
/O2 /Ob2
/D _MBCS /D WIN32 /D _WINDOWS /D NDEBUG /D "CMAKE_INTDIR=\"Release\""
/EHsc /MD /GS
/fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline
/std:c++latest
/Fo"ulight.dir\Release\\"
/Fd"D:\a\ulight\ulight\build\Release\ulight.pdb"
/external:W4 /Gd /TP /errorReport:queue
D:\a\ulight\ulight\src\main\cpp\chars.cpp
D:\a\ulight\ulight\src\main\cpp\cpp.cpp
D:\a\ulight\ulight\src\main\cpp\lua.cpp
D:\a\ulight\ulight\src\main\cpp\mmml.cpp
D:\a\ulight\ulight\src\main\cpp\parse_utils.cpp
D:\a\ulight\ulight\src\main\cpp\ulight.cpp
According to CMake's output, the compiler is:
-- Building for: Visual Studio 17 2022
-- The C compiler identification is MSVC 19.43.34808.0
-- The CXX compiler identification is MSVC 19.43.34808.0
This seems more up-to-date than the latest version available on Compiler Explorer. Despite that, I cannot reproduce the issue there.
Why would I get these bogus errors? The full log is at https://github/Eisenwave/ulight/actions/runs/14104181487/job/39506850293
Share Improve this question edited Mar 27 at 16:03 Jan Schultke asked Mar 27 at 10:34 Jan SchultkeJan Schultke 40.7k8 gold badges99 silver badges177 bronze badges 3- 1 Compile fine here – Jarod42 Commented Mar 27 at 10:43
- @Jarod42 minimal repro is in the answer now. – Jan Schultke Commented Mar 27 at 16:03
- I can have msvc ICE by removing added pointer Demo – Jarod42 Commented Mar 27 at 16:54
1 Answer
Reset to default 3While there are quite a few issues in the build, the most nonsensical message turned out to be a compiler bug (see report), with the following insane minimal reproducible example (https://godbolt./z/oYrr9oehG):
template <bool nothrow>
struct S {
// error C2065: 'nothrow': undeclared identifier
using type = int(void*) noexcept(nothrow);
type* member;
};
void f() {
S<false> s;
auto p = s.member;
}
Note that S
in the example is Function_Ref_Base
in the original.
The remaining messages are related to C++23 features that are not supported by MSVC yet, so I consider this issue solved.
本文标签: cC23 MSVC build in GitHub CI fails for inexplicable reasonsStack Overflow
版权声明:本文标题:c++ - C++23 MSVC build in GitHub CI fails for inexplicable reasons - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744096244a2532949.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论