[Bug c++/71774] New: Bogus "is protected" error when list-initializing a base class with a defaulted protected constructor and a virtual function
rs2740 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 6 05:22:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71774
Bug ID: 71774
Summary: Bogus "is protected" error when list-initializing a
base class with a defaulted protected constructor and
a virtual function
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rs2740 at gmail dot com
Target Milestone: ---
Reduced from http://stackoverflow.com/q/38213809/2756719. Repro:
class Meow
{
protected:
Meow() =default;
virtual void f() {}
};
class Purr : public Meow
{
public:
Purr()
: Meow{}
{}
};
prog.cc: In constructor 'Purr::Purr()':
prog.cc:12:14: error: 'constexpr Meow::Meow()' is protected within this context
: Meow{}
^
prog.cc:4:5: note: declared protected here
Meow() =default;
^~~~
Possibly related to PR63151, however this example reproduces in GCC 4.7.3 and
4.8.5 (on Wandbox), while that PR is known to work in 4.8.2.
More information about the Gcc-bugs
mailing list