Код: Выделить всё
// test.cpp
#include
#include
int main () {
std::vector vec = {1,2,3};
std::println("vector: {}",vec);
return 0;
}
Скомпилировано с MSVC 19.42 Программа дает желаемую выход: < /p>
Код: Выделить всё
cl /EHs test.cpp /std:c++latest
D:\>test.exe vector: [1, 2, 3]
< /code>
Но с GCC 14 и Clang 19 он не компилируется. < /p>
clang++ test.cpp -std=c++23
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/format:4065:3: error:
static assertion failed due to requirement
'is_default_constructible_v':
g++ test.cpp -std=c++23
/usr/include/c++/14/format:4065:10: error: static assertion failed:
std::formatter must be specialized for each type being formatted
(is_default_constructible_v && ...)
Подробнее здесь: https://stackoverflow.com/questions/794 ... -and-clang