Bug 28988 - [4.0/4.1/4.2/4.3 Regression] g++ does not check first type name in pseudo-destructor-name
Summary: [4.0/4.1/4.2/4.3 Regression] g++ does not check first type name in pseudo-des...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P2 normal
Target Milestone: 4.1.2
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: accepts-invalid, patch
Depends on:
Blocks: 29843
  Show dependency treegraph
 
Reported: 2006-09-08 19:02 UTC by Jorn Wolfgang Rennecke
Modified: 2007-01-28 18:19 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3 2.95.3 3.0.4 3.2.3
Known to fail: 3.4.0 4.0.0 4.1.0 4.2.0
Last reconfirmed: 2006-09-09 04:16:24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2006-09-08 19:02:25 UTC
The following code is accepted, contrary to clause 5.2.4:

typedef int C;
typedef double D;

void
f ()
{
  C o;

  o.D::~C ();
}
Comment 1 Andrew Pinski 2006-09-09 04:16:24 UTC
Confirmed, another regression from 3.3.3:
t.cc: In function `void f()':
t.cc:9: qualified type `double' does not match destructor name `~C'
t.cc:9: type of `o' does not match destructor type `double' (type was `C'
Comment 2 Andrew Pinski 2006-09-09 06:40:51 UTC
lookup_destructor has become dead code which did the checking at least on the mainline.
finish_pseudo_destructor_expr is where the new code is now.
Adding:
      if (scope && !check_dtor_name (scope, destructor))
	{
	  error ("qualified type %qT does not match destructor name ~%qT",
		 scope, destructor);
	  return error_mark_node;
	}
To finish_pseudo_destructor_expr fixes this bug.
Comment 3 Andrew Pinski 2006-09-09 21:22:09 UTC
Mine.
Comment 4 Andrew Pinski 2006-09-14 06:38:48 UTC
(In reply to comment #2)
> Adding:
....
> To finish_pseudo_destructor_expr fixes this bug.

This caused two regressions which I still need to look into, both are ICEs.
Comment 5 Andrew Pinski 2006-09-26 16:59:45 UTC
Just needed to add a check for types before calling check_dtor_name.
Testing the new fix right now.
Comment 6 Steven Bosscher 2007-01-27 22:30:28 UTC
Approval of the patch at http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01429.html was posted today: http://gcc.gnu.org/ml/gcc-patches/2007-01/msg02253.html
Comment 7 Andrew Pinski 2007-01-28 18:09:37 UTC
Subject: Bug 28988

Author: pinskia
Date: Sun Jan 28 18:09:25 2007
New Revision: 121261

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121261
Log:
2007-01-28  Andrew Pinski  <pinskia@gmail.com>

        PR C++/28988
        * semantics.c (finish_pseudo_destructor_expr): Check the
        destrutor name by calling check_dtor_name.

2007-01-28  Andrew Pinski  <pinskia@gmail.com>

        PR C++/28988
        * g++.dg/expr/dtor4.C: New test.




Added:
    trunk/gcc/testsuite/g++.dg/expr/dtor4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog

Comment 8 Andrew Pinski 2007-01-28 18:19:09 UTC
Subject: Bug 28988

Author: pinskia
Date: Sun Jan 28 18:18:54 2007
New Revision: 121263

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121263
Log:
2007-01-28  Andrew Pinski  <pinskia@gmail.com>

        PR C++/28988
        * semantics.c (finish_pseudo_destructor_expr): Check the
        destrutor name by calling check_dtor_name.

2007-01-28  Andrew Pinski  <pinskia@gmail.com>

        PR C++/28988
        * g++.dg/expr/dtor4.C: New test.



Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/expr/dtor4.C
      - copied unchanged from r121261, trunk/gcc/testsuite/g++.dg/expr/dtor4.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/semantics.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 9 Andrew Pinski 2007-01-28 18:19:10 UTC
Subject: Bug 28988

Author: pinskia
Date: Sun Jan 28 18:18:52 2007
New Revision: 121262

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121262
Log:
2007-01-28  Andrew Pinski  <pinskia@gmail.com>

        PR C++/28988
        * semantics.c (finish_pseudo_destructor_expr): Check the
        destrutor name by calling check_dtor_name.

2007-01-28  Andrew Pinski  <pinskia@gmail.com>

        PR C++/28988
        * g++.dg/expr/dtor4.C: New test.



Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/expr/dtor4.C
      - copied unchanged from r121261, trunk/gcc/testsuite/g++.dg/expr/dtor4.C
Modified:
    branches/gcc-4_2-branch/gcc/cp/ChangeLog
    branches/gcc-4_2-branch/gcc/cp/semantics.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 10 Andrew Pinski 2007-01-28 18:19:21 UTC
Fixed.