我有以下代码,无法使用 x86_64 GCC 13 进行编译:
#include <iostream>
#include <stdfloat>
int main() {
std::cout << std::float128_t{1} << '\n';
}
Run Code Online (Sandbox Code Playgroud)
这给了我以下错误:
<source>: In function 'int main()':
<source>:5:15: error: ambiguous overload for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::float128_t' {aka '_Float128'})
5 | std::cout << std::float128_t{1} << '\n';
| ~~~~~~~~~ ^~ ~~~~~~~~~~~~~
| | |
| | std::float128_t {aka _Float128}
| std::ostream {aka std::basic_ostream<char>}
Run Code Online (Sandbox Code Playgroud)
列出的不明确重载是:
operator<<(long)operator<<(unsigned long)operator<<(bool)令人惊讶的是,operator<<(float)其他浮点类型没有列出。
我检查了 C++23 的编译器支持页面,应该支持此功能:
| C++23 特性 | 文件) … |
|---|