public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gianni at mariani dot ws" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/19249] New: abstract classes should not access virtually inherited class constructor Date: Tue, 04 Jan 2005 05:36:00 -0000 [thread overview] Message-ID: <20050104053610.19249.gianni@mariani.ws> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1602 bytes --] Since abstract classes cannot be instantiated without being derived, any classes inherited virtually in an abstract class cannot have their constructor called by the abstract class constuctor hence the abstract class constructor must not reference the constructor of any virtually inherited class. Discussion on comp.std.c++ : http://groups-beta.google.com/group/comp.std.c++/browse_thread/thread/0d8cf2d93117bfa1#3f6fda6a03cb5c6a Diagnostics : /gcc/gcc-4.0-20041128-build/bin/g++ -o xx virt_inhr_vcbug.cpp virt_inhr_vcbug.cpp: In constructor Interface::Interface(): virt_inhr_vcbug.cpp:4: error: controller::controller() is private virt_inhr_vcbug.cpp:22: error: within this context Code: class controller { controller(); // private don't want anyone to call this public: controller( int ); // this should be called instead }; class Interface : virtual public controller { public: virtual void DoThing() = 0; }; class Application : public Interface { public: Application() : controller( 3 ) { } void DoThing() { // Doing it here ! } }; -- Summary: abstract classes should not access virtually inherited class constructor Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gianni at mariani dot ws CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19249
next reply other threads:[~2005-01-04 5:36 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-01-04 5:36 gianni at mariani dot ws [this message] 2005-01-04 5:42 ` [Bug c++/19249] " pinskia at gcc dot gnu dot org 2005-01-04 9:15 ` pinskia at gcc dot gnu dot org 2005-01-05 14:30 ` jkanze at cheuvreux dot com 2005-01-14 3:00 ` gianni at mariani dot ws 2005-01-14 3:08 ` pinskia at gcc dot gnu dot org 2005-01-14 6:47 ` gianni at mariani dot ws 2005-05-01 2:51 ` pinskia at gcc dot gnu dot org 2005-07-23 20:07 ` bangerth at dealii dot org
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=20050104053610.19249.gianni@mariani.ws \ --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).