public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96876] New: missing check for destructibility of base classes in aggregate initialization
@ 2020-08-31 20:53 richard-gccbugzilla at metafoo dot co.uk
2020-08-31 22:29 ` [Bug c++/96876] " mpolacek at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2020-08-31 20:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96876
Bug ID: 96876
Summary: missing check for destructibility of base classes in
aggregate initialization
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard-gccbugzilla at metafoo dot co.uk
Target Milestone: ---
GCC accepts this invalid code (which is ill-formed because [dcl.init.aggr]/8
says it potentially-invokes the destructor for B, which [class.dtor]/15 says
requires the destructor to be accessible):
struct B {
protected:
~B() {}
};
struct C : B { int n; };
int f();
void g() {
C c{{}, f()};
}
... and generates wrong code for this similar example:
#include <stdio.h>
struct B {
public:
~B() { puts("destroyed"); }
};
struct C : B { int n; };
int f() { throw "hello"; }
int main() {
try {
C c{{}, f()};
} catch (const char*) {
}
}
... which is required to print "destroyed" (when the B base class subobject is
destroyed during stack unwinding), but with GCC does not.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96876] missing check for destructibility of base classes in aggregate initialization
2020-08-31 20:53 [Bug c++/96876] New: missing check for destructibility of base classes in aggregate initialization richard-gccbugzilla at metafoo dot co.uk
@ 2020-08-31 22:29 ` mpolacek at gcc dot gnu.org
2022-01-28 4:42 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-31 22:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96876
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-08-31
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed. Doesn't seem to be a regression.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96876] missing check for destructibility of base classes in aggregate initialization
2020-08-31 20:53 [Bug c++/96876] New: missing check for destructibility of base classes in aggregate initialization richard-gccbugzilla at metafoo dot co.uk
2020-08-31 22:29 ` [Bug c++/96876] " mpolacek at gcc dot gnu.org
@ 2022-01-28 4:42 ` jason at gcc dot gnu.org
2022-02-09 1:10 ` cvs-commit at gcc dot gnu.org
2022-02-09 1:12 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-28 4:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96876
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
CC| |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96876] missing check for destructibility of base classes in aggregate initialization
2020-08-31 20:53 [Bug c++/96876] New: missing check for destructibility of base classes in aggregate initialization richard-gccbugzilla at metafoo dot co.uk
2020-08-31 22:29 ` [Bug c++/96876] " mpolacek at gcc dot gnu.org
2022-01-28 4:42 ` jason at gcc dot gnu.org
@ 2022-02-09 1:10 ` cvs-commit at gcc dot gnu.org
2022-02-09 1:12 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-09 1:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96876
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:53cac72cf0821217f99d0640ba72cc2999ec7dc0
commit r12-7117-g53cac72cf0821217f99d0640ba72cc2999ec7dc0
Author: Jason Merrill <jason@redhat.com>
Date: Fri Feb 4 18:25:51 2022 -0500
c++: cleanup constant-init'd members [PR96876]
This is a case missed by my recent fixes to aggregate initialization and
exception cleanup for PR94041 et al: we also need to clean up members with
constant initialization if initialization of a later member throws.
It also occurs to me that we needn't bother building the cleanups if
-fno-exceptions; build_vec_init already doesn't.
PR c++/96876
gcc/cp/ChangeLog:
* typeck2.cc (split_nonconstant_init_1): Push cleanups for
preceding members with constant initialization.
(maybe_push_temp_cleanup): Do nothing if -fno-exceptions.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/aggr-base11.C: New test.
* g++.dg/eh/aggregate2.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96876] missing check for destructibility of base classes in aggregate initialization
2020-08-31 20:53 [Bug c++/96876] New: missing check for destructibility of base classes in aggregate initialization richard-gccbugzilla at metafoo dot co.uk
` (2 preceding siblings ...)
2022-02-09 1:10 ` cvs-commit at gcc dot gnu.org
@ 2022-02-09 1:12 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2022-02-09 1:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96876
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 12.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-09 1:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 20:53 [Bug c++/96876] New: missing check for destructibility of base classes in aggregate initialization richard-gccbugzilla at metafoo dot co.uk
2020-08-31 22:29 ` [Bug c++/96876] " mpolacek at gcc dot gnu.org
2022-01-28 4:42 ` jason at gcc dot gnu.org
2022-02-09 1:10 ` cvs-commit at gcc dot gnu.org
2022-02-09 1:12 ` jason at gcc dot gnu.org
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).