public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63151] New: Accessibility error when brace-constructing base class with protected defaulted constructor and member variable
@ 2014-09-03 2:33 lukeallardyce at gmail dot com
2014-12-13 23:46 ` [Bug c++/63151] " ville.voutilainen at gmail dot com
2015-07-12 13:44 ` db0451 at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: lukeallardyce at gmail dot com @ 2014-09-03 2:33 UTC (permalink / raw)
To: gcc-bugs
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/63151] Accessibility error when brace-constructing base class with protected defaulted constructor and member variable
2014-09-03 2:33 [Bug c++/63151] New: Accessibility error when brace-constructing base class with protected defaulted constructor and member variable lukeallardyce at gmail dot com
@ 2014-12-13 23:46 ` ville.voutilainen at gmail dot com
2015-07-12 13:44 ` db0451 at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-13 23:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63151
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-13
CC| |ville.voutilainen at gmail dot com
Known to work| |4.8.2
Ever confirmed|0 |1
Known to fail| |4.9.1, 5.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/63151] Accessibility error when brace-constructing base class with protected defaulted constructor and member variable
2014-09-03 2:33 [Bug c++/63151] New: Accessibility error when brace-constructing base class with protected defaulted constructor and member variable lukeallardyce at gmail dot com
2014-12-13 23:46 ` [Bug c++/63151] " ville.voutilainen at gmail dot com
@ 2015-07-12 13:44 ` db0451 at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: db0451 at gmail dot com @ 2015-07-12 13:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63151
DB <db0451 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |db0451 at gmail dot com
--- Comment #1 from DB <db0451 at gmail dot com> ---
Just ran into this one myself. Though mine seems contigent on virtual
inheritance, so rather than sandwiching it in here, I opened a separate ticket
just in case:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66847
Added a link back to this one.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-12 13:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-03 2:33 [Bug c++/63151] New: Accessibility error when brace-constructing base class with protected defaulted constructor and member variable lukeallardyce at gmail dot com
2014-12-13 23:46 ` [Bug c++/63151] " ville.voutilainen at gmail dot com
2015-07-12 13:44 ` db0451 at gmail dot com
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).