public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "Simon.Richter at hogyros dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114675] New: warning for "reference to not fully constructed object" Date: Wed, 10 Apr 2024 09:15:47 +0000 [thread overview] Message-ID: <bug-114675-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114675 Bug ID: 114675 Summary: warning for "reference to not fully constructed object" Product: gcc Version: 13.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Simon.Richter at hogyros dot de Target Milestone: --- We have an object that contains several sub-objects that should reference each other through interface pointers. I'd like to make sure that interface pointers given to objects constructed later already point to initialized objects. So, for struct everything { everything() : a(), b(c), c(a) { } A a; B b; C c; }; I'm passing a reference to the not-yet-constructed C object to B's constructor, so this is unsafe despite being legal C++. I wonder if it would be possible to generate a warning here.
next reply other threads:[~2024-04-10 9:15 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-10 9:15 Simon.Richter at hogyros dot de [this message] 2024-04-10 10:42 ` [Bug c++/114675] " redi at gcc dot gnu.org 2024-04-10 11:14 ` pinskia at gcc dot gnu.org 2024-04-10 12:12 ` redi at gcc dot gnu.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=bug-114675-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).