c++ - Implicitly deleted default constructor works in C++14 -
i doing tests code did not compile, , discovered code:
struct { a(int) {}; virtual void foo() = 0; }; struct b : public virtual { virtual void bar() = 0; }; struct c : public b { c() : a(1) {} virtual void foo() override {} virtual void bar() override {} }; int main() { c c; return 0; }
in c++11 fails compile (on g++ 7.0.1) ‘b::b()’ implicitly deleted because default definition ill-formed
, while in c++14 compiles successfully.
i've tried find out new feature of c++14 allowed work, no avail. description in cppreference not mention of sort seems.
why can code compile in c++14 not in c++11?
definitively it's bug in gcc 7 because when have checked out code in online compiler gcc 7+, has worked without kind of problem.
so here give ide online can set favorite compiler , try tests, if want.
sorry can't better couldn't reproduce error.
Comments
Post a Comment