[英]Why do I get "error: reference to 'align_val_t' is ambiguous" with Intel's C++ 2022 compiler when using std::inplace_merge?
When I try to compile this with the Intel C++ Compiler 2022 toolset for Visual Studio 2022:当我尝试使用适用于 Visual Studio 2022 的 Intel C++ Compiler 2022 工具集对其进行编译时:
#include <algorithm>
int main()
{
int x = 0;
std::inplace_merge(&x, &x, &x);
}
I get:我得到:
VC\Tools\MSVC\14.34.31933\include\xmemory(1429,48): error : reference to 'align_val_t' is ambiguous
_Pbuf = ::operator new (_Size, align_val_t{alignof(_Ty)}, nothrow);
^
VC\Tools\MSVC\14.34.31933\include\algorithm(7152,57): note: in instantiation of function template specialization 'std::_Optimistic_temporary_buffer<int>::_Optimistic_temporary_buffer<long long>' requested here
_Optimistic_temporary_buffer<_Iter_value_t<_BidIt>> _Temp_buf{(_STD min)(_Count1, _Count2)};
^
VC\Tools\MSVC\14.34.31933\include\algorithm(7160,10): note: in instantiation of function template specialization 'std::inplace_merge<int *, std::less<>>' requested here
_STD inplace_merge(_First, _Mid, _Last, less<>{});
^
Temp.cpp(6,7): note: in instantiation of function template specialization 'std::inplace_merge<int *>' requested here
std::inplace_merge(&x, &x, &x);
^
VC\14.34.31933\include\vcruntime_new.h(27,16): note: candidate found by name lookup is 'std::align_val_t'
enum class align_val_t : size_t {};
^
note: candidate found by name lookup is 'std::align_val_t'
I tried digging through the STL sources, but I can't find where the ambiguity is.我尝试挖掘 STL 来源,但找不到歧义所在。
Why does this error occur?为什么会出现这个错误? And how do I get around it?我该如何解决?
Answering my own question, but it seems to be a bug with precompiled headers .回答我自己的问题,但这似乎是预编译标头的错误。 This occurs even if the precompiled header files are empty.即使预编译的 header 文件为空,也会发生这种情况。
Avoiding precompiled headers seems to avoid the issue.避免预编译头文件似乎可以避免这个问题。
If anyone has a better workaround or more details, please do post it.如果有人有更好的解决方法或更多详细信息,请张贴。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.