This simple code gives unexpected results. At least for me...
#include <iostream>
class cls1
{
public:
cls1(){std::cout << "cls1()" << std::endl;};
cls1(int, int) : cls1() {std::cout << "cls1(int, int)" << std::endl;}
};
class cls2 : public cls1
{
public:
using cls1::cls1;
cls2() = delete;
};
int main()
{
cls2 c();
return 0;
}
I expect the result to be: cls1 (), since the default constructor is deleted for cls2, but the code does not output anything, although it compiles and works fine. I am using GCC ver. 4.8.2. Compile with:
$ g++ -std=c++11 -g test.cpp
$ ./a.out
Question: how should he behave?
Thanks!
source
share