public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52746] New: [4.7 Regression] Explicit virtual destructor call replaced by direct call in template function
@ 2012-03-28 2:18 loic.yhuel at gmail dot com
2012-03-28 9:03 ` [Bug c++/52746] [4.7/4.8 " jakub at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: loic.yhuel at gmail dot com @ 2012-03-28 2:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52746
Bug #: 52746
Summary: [4.7 Regression] Explicit virtual destructor call
replaced by direct call in template function
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: loic.yhuel@gmail.com
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
#include <stdio.h>
class A
{
public:
virtual ~A()
{
printf("~A()\n");
}
};
class B : public A
{
public:
virtual ~B()
{
printf("~B()\n");
}
};
template<int> void test()
{
B * b = new B;
A * a = reinterpret_cast<A*>(b);
a->~A();
::operator delete(b);
}
int main(void)
{
test<0>();
return 0;
}
Compile with g++
With 4.6.3, it outputs "~B()" and "~A()", since a->~A() is the expected virtual
call, which will target B::~B() in this case.
With 4.7.0, it only outputs "~A()", a->~A() is a direct call to A::~A().
The bug doesn't happen if test() function is not a template.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/52746] [4.7/4.8 Regression] Explicit virtual destructor call replaced by direct call in template function
2012-03-28 2:18 [Bug c++/52746] New: [4.7 Regression] Explicit virtual destructor call replaced by direct call in template function loic.yhuel at gmail dot com
@ 2012-03-28 9:03 ` jakub at gcc dot gnu.org
2012-03-29 2:47 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-28 9:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52746
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-03-28
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
Target Milestone|--- |4.7.1
Summary|[4.7 Regression] Explicit |[4.7/4.8 Regression]
|virtual destructor call |Explicit virtual destructor
|replaced by direct call in |call replaced by direct
|template function |call in template function
Ever Confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-28 08:53:58 UTC ---
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183133
aka second part of PR48051 fix.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/52746] [4.7/4.8 Regression] Explicit virtual destructor call replaced by direct call in template function
2012-03-28 2:18 [Bug c++/52746] New: [4.7 Regression] Explicit virtual destructor call replaced by direct call in template function loic.yhuel at gmail dot com
2012-03-28 9:03 ` [Bug c++/52746] [4.7/4.8 " jakub at gcc dot gnu.org
@ 2012-03-29 2:47 ` jason at gcc dot gnu.org
2012-03-29 6:15 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2012-03-29 2:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52746
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/52746] [4.7/4.8 Regression] Explicit virtual destructor call replaced by direct call in template function
2012-03-28 2:18 [Bug c++/52746] New: [4.7 Regression] Explicit virtual destructor call replaced by direct call in template function loic.yhuel at gmail dot com
2012-03-28 9:03 ` [Bug c++/52746] [4.7/4.8 " jakub at gcc dot gnu.org
2012-03-29 2:47 ` jason at gcc dot gnu.org
@ 2012-03-29 6:15 ` jason at gcc dot gnu.org
2012-03-29 13:23 ` jason at gcc dot gnu.org
2012-03-29 13:23 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2012-03-29 6:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52746
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2012-03-29 02:58:33 UTC ---
Author: jason
Date: Thu Mar 29 02:58:29 2012
New Revision: 185945
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185945
Log:
PR c++/52746
* typeck.c (lookup_destructor): Clear BASELINK_QUALIFIED_P if
we didn't get an explicit scope.
* pt.c (tsubst_baselink): Likewise.
Added:
trunk/gcc/testsuite/g++.dg/overload/virtual2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/cp/typeck.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/52746] [4.7/4.8 Regression] Explicit virtual destructor call replaced by direct call in template function
2012-03-28 2:18 [Bug c++/52746] New: [4.7 Regression] Explicit virtual destructor call replaced by direct call in template function loic.yhuel at gmail dot com
` (3 preceding siblings ...)
2012-03-29 13:23 ` jason at gcc dot gnu.org
@ 2012-03-29 13:23 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2012-03-29 13:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52746
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-03-29 13:20:24 UTC ---
Author: jason
Date: Thu Mar 29 13:20:18 2012
New Revision: 185961
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185961
Log:
PR c++/52746
* typeck.c (lookup_destructor): Clear BASELINK_QUALIFIED_P if
we didn't get an explicit scope.
* pt.c (tsubst_baselink): Likewise.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/overload/virtual2.C
Modified:
branches/gcc-4_7-branch/gcc/cp/ChangeLog
branches/gcc-4_7-branch/gcc/cp/pt.c
branches/gcc-4_7-branch/gcc/cp/typeck.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/52746] [4.7/4.8 Regression] Explicit virtual destructor call replaced by direct call in template function
2012-03-28 2:18 [Bug c++/52746] New: [4.7 Regression] Explicit virtual destructor call replaced by direct call in template function loic.yhuel at gmail dot com
` (2 preceding siblings ...)
2012-03-29 6:15 ` jason at gcc dot gnu.org
@ 2012-03-29 13:23 ` jason at gcc dot gnu.org
2012-03-29 13:23 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2012-03-29 13:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52746
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-03-29 13:21:08 UTC ---
Fixed for 4.7.1/4.8.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-29 13:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28 2:18 [Bug c++/52746] New: [4.7 Regression] Explicit virtual destructor call replaced by direct call in template function loic.yhuel at gmail dot com
2012-03-28 9:03 ` [Bug c++/52746] [4.7/4.8 " jakub at gcc dot gnu.org
2012-03-29 2:47 ` jason at gcc dot gnu.org
2012-03-29 6:15 ` jason at gcc dot gnu.org
2012-03-29 13:23 ` jason at gcc dot gnu.org
2012-03-29 13:23 ` 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).