public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "lukeallardyce at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/63151] New: Accessibility error when brace-constructing base class with protected defaulted constructor and member variable Date: Wed, 03 Sep 2014 02:33:00 -0000 [thread overview] Message-ID: <bug-63151-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63151 Bug ID: 63151 Summary: Accessibility error when brace-constructing base class with protected defaulted constructor and member variable Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lukeallardyce at gmail dot com struct Foo { protected: Foo() = default; int t; }; struct Bar : public Foo { Bar(): Foo{} { } }; g++ -std=c++1y -c test.cpp test.cpp: In constructor 'Bar::Bar()': test.cpp:4:3: error: 'Foo::Foo()' is protected Foo() = default; ^ test.cpp:12:14: error: within this context Bar(): Foo{} { } The problem seems to be an astral conjunction of the braces, the defaulted base class constructor, and the presence of a member variable in the base class. Removing any one of these gives no error: class Foo { protected: Foo() {} // Fine int t; }; class Foo { protected: Foo() = default; // Also fine }; class Bar : public Foo { Bar(): Foo() { } // Also fine }; Tested on: Linux (Arch): gcc version 4.9.1 (GCC) OSX: gcc version 4.9.1 (MacPorts gcc49 4.9.1_0) Windows: gcc version 4.9.0 (x86_64-win32-seh-rev2, Built by MinGW-W64 project)
next reply other threads:[~2014-09-03 2:33 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-03 2:33 lukeallardyce at gmail dot com [this message] 2014-12-13 23:46 ` [Bug c++/63151] " ville.voutilainen at gmail dot com 2015-07-12 13:44 ` db0451 at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-63151-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).