Bug 29408 - [4.1 regression] parse error for valid code
[4.1 regression] parse error for valid code
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
4.1.2
: P1 normal
: 4.1.2
Assigned To: Mark Mitchell
: rejects-valid
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-10 01:17 UTC by Debian GCC Maintainers
Modified: 2006-10-17 00:01 UTC (History)
8 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.4 4.1.1
Known to fail: 4.1.2 4.2.0
Last reconfirmed: 2006-10-10 08:52:52


Attachments
preprocessed source (146.85 KB, application/x-bzip)
2006-10-10 01:18 UTC, Debian GCC Maintainers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2006-10-10 01:17:08 UTC
works with 4.0.4, 4.1.1, 4.2.0, fails with 4.1 branch 20061008

$ g++ -c -Wall -fPIC -fexceptions -frtti -I/usr/include/python2.3 -I/usr/share/python2.3/CXX -I/usr/include/subversion-1 -I/usr/include/apr-1.0 -I. -DNDEBUG -o pysvn.o pysvn.cpp
/usr/include/python2.3/CXX/Objects.hxx:1932: error: parse error in template argument list
Comment 1 Debian GCC Maintainers 2006-10-10 01:18:42 UTC
Created attachment 12401 [details]
preprocessed source
Comment 2 Andrew Pinski 2006-10-10 05:00:50 UTC
I don't think this is valid code, reduced testcase:
template <class T> class a
{
  ~a<T>();
};
Comment 3 Richard Biener 2006-10-10 08:52:52 UTC
It's at least accepted by EDG and Comeau in strict-ansi mode.  (so, confirmed)
Comment 4 Andrew Pinski 2006-10-10 16:30:21 UTC
(In reply to comment #3)
> It's at least accepted by EDG and Comeau in strict-ansi mode.  (so, confirmed)
Don't take EDG/Comeau as conforming to the standard.
Comment 5 Debian GCC Maintainers 2006-10-10 18:04:28 UTC
20060928 works

  Matthias
Comment 6 Debian GCC Maintainers 2006-10-10 18:25:57 UTC
r117410 is the first version showing the failure.

r117410 | mmitchel | 2006-10-03 20:06:00 +0200 (Di, 03 Okt 2006) | 12 lines

        PR c++/29138
        * decl2.c (grokfield): Don't handle access declarations here.
        * parser.c (cp_parser_using_declaration): Handle access
        declarations too.
        (cp_parser_block_declaration): Adjust calls to
        cp_parser_using_declaration.
        (cp_parser_member_declaration): Likewise.  Use
        cp_parser_using_declaration to look for access_declarations.
        PR c++/29138
        * g++.dg/inherit/access8.C: New test.
        * g++.dg/template/dtor4.C: Tweak error messages.
Comment 7 Debian GCC Maintainers 2006-10-12 00:37:13 UTC
fails with trunk 20061012 as well.

  Matthias
Comment 8 Wolfgang Bangerth 2006-10-12 04:27:26 UTC
I don't believe the code is valid.

W.
Comment 9 Mark Mitchell 2006-10-15 21:21:18 UTC
There is long-standing confusion in the C++ standard regarding the naming of destructors in various situations.  (Part of the issue is to what extent destructors have names, and how the injection of class names into their own scopes work, and how the lookup rules for qualified names apply to destructors, and so forth.)  However, I do think this code should be accepted; it doesn't look like one of the particularly tricky cases.
Comment 10 Mark Mitchell 2006-10-16 23:08:05 UTC
Subject: Bug 29408

Author: mmitchel
Date: Mon Oct 16 23:07:46 2006
New Revision: 117800

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117800
Log:
	PR c++/29408
	* parser.c (cp_parser_using_declaration): Stop parsing when
	something goes wrong with an access declaration.
	PR c++/29408
	* g++.dg/parse/dtor12.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/dtor12.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog

Comment 11 Mark Mitchell 2006-10-16 23:12:05 UTC
Fixed in 4.2.0.
Comment 12 Mark Mitchell 2006-10-17 00:01:28 UTC
Subject: Bug 29408

Author: mmitchel
Date: Tue Oct 17 00:01:14 2006
New Revision: 117802

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117802
Log:
	PR c++/29408
	* parser.c (cp_parser_using_declaration): Stop parsing when
	something goes wrong with an access declaration.
	PR c++/29408
	* g++.dg/parse/dtor12.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/dtor12.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/parser.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 13 Mark Mitchell 2006-10-17 00:01:37 UTC
Fixed in 4.1.2.