I have the following code :
#include <iostream>
#include <optional>
class Test
{
public:
Test() = delete;
Test& operator=(const Test&) = delete;
Test& operator=(Test&&) = delete;
Test(const Test&) = delete;
Test(Test&&) = delete;
};
int main()
{
Test test{};
}
This code mostly is compiled with various compilers (gcc and clang) and the program is terminated successfully. My question here is how the object Test is constructed. which constructor is called? Here https://www.onlinegdb.com/online_c++_compiler With C++20 selected as the std the compilation fails but with 17 the code compiles.