Consider that minimized code snippet:
#include <vector>
class Bar
{
public:
constexpr Bar() {}
};
consteval Bar foo()
{
return Bar();
}
int main()
{
std::vector<Bar> bars{ foo(), foo() };
}
This doesn't compile on latest MSVC compiler (Visual Studio 2022 version 17.3.3), but does on Clang or GCC.
Is the code somewhere ill formed, or it is a bug in MSVC?
foo()
returns an rvalue). – FourthclassBar
class was copyable. – Tamas