pra*_*pin 14 c++ visual-c++ c++20 consteval
考虑最小化的代码片段:
#include <vector>
class Bar
{
public:
constexpr Bar() {}
};
consteval Bar foo()
{
return Bar();
}
int main()
{
std::vector<Bar> bars{ foo(), foo() };
}
Run Code Online (Sandbox Code Playgroud)
这不能在最新的 MSVC 编译器(Visual Studio 2022 版本 17.3.3)上编译,但可以在 Clang 或 GCC 上编译。
代码是否格式不正确,或者是 MSVC 中的错误?
pra*_*pin 10
从评论来看,这确实是MSVC中的一个错误。
因此我在 Visual Studio Community 上填写了一份错误报告。
https://developercommunity.visualstudio.com/t/Cannot-use-consteval-functions-returning/10145209
| 归档时间: |
|
| 查看次数: |
655 次 |
| 最近记录: |