public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition
@ 2005-01-03 21:00 austern at apple dot com
  2005-01-03 21:07 ` [Bug c++/19244] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: austern at apple dot com @ 2005-01-03 21:00 UTC (permalink / raw)
  To: gcc-bugs

gcc 4.0 incorrectly rejects the following valid code:
typedef struct { void f(); } f;
void f::f() { }

It treats f::f as referring to a constructor, and then gets confused because this isn't the right syntax for 
a constructor definition.  However (12.1/3), "a typedef-name that names a class shall not be used as 
the identifier in the declarator for a constructor declaration."

Note that this only happens for an anonymous class.  If I instead write
typedef struct e { void f(); } f;
then this compiles without error.

This is a regression.  3.3 handles this correctly.

-- 
           Summary: Typedef of anonymous class incorrectly handled in member
                    function definition
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: austern at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.7.0
  GCC host triplet: powerpc-apple-darwin7.7.0
GCC target triplet: powerpc-apple-darwin7.7.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19244


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/19244] [4.0 Regression] Typedef of anonymous class incorrectly handled in member function definition
  2005-01-03 21:00 [Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition austern at apple dot com
@ 2005-01-03 21:07 ` pinskia at gcc dot gnu dot org
  2005-01-04 15:50 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-03 21:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-03 21:07 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
      Known to fail|                            |4.0.0
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-03 21:07:28
               date|                            |
            Summary|Typedef of anonymous class  |[4.0 Regression] Typedef of
                   |incorrectly handled in      |anonymous class incorrectly
                   |member function definition  |handled in member function
                   |                            |definition
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19244


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/19244] [4.0 Regression] Typedef of anonymous class incorrectly handled in member function definition
  2005-01-03 21:00 [Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition austern at apple dot com
  2005-01-03 21:07 ` [Bug c++/19244] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-01-04 15:50 ` pinskia at gcc dot gnu dot org
  2005-01-06 16:38 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-04 15:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-04 15:50 -------
: Search converges between 2004-07-17-trunk (#488) and 2004-07-18-trunk (#489).


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|3.4.0                       |3.4.0 3.4.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19244


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/19244] [4.0 Regression] Typedef of anonymous class incorrectly handled in member function definition
  2005-01-03 21:00 [Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition austern at apple dot com
  2005-01-03 21:07 ` [Bug c++/19244] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2005-01-04 15:50 ` pinskia at gcc dot gnu dot org
@ 2005-01-06 16:38 ` mmitchel at gcc dot gnu dot org
  2005-01-06 20:21 ` mmitchel at gcc dot gnu dot org
  2005-01-06 20:21 ` cvs-commit at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-01-06 16:38 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19244


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/19244] [4.0 Regression] Typedef of anonymous class incorrectly handled in member function definition
  2005-01-03 21:00 [Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition austern at apple dot com
                   ` (2 preceding siblings ...)
  2005-01-06 16:38 ` mmitchel at gcc dot gnu dot org
@ 2005-01-06 20:21 ` mmitchel at gcc dot gnu dot org
  2005-01-06 20:21 ` cvs-commit at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-01-06 20:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-01-06 20:21 -------
Fixed in GCC 4.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19244


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/19244] [4.0 Regression] Typedef of anonymous class incorrectly handled in member function definition
  2005-01-03 21:00 [Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition austern at apple dot com
                   ` (3 preceding siblings ...)
  2005-01-06 20:21 ` mmitchel at gcc dot gnu dot org
@ 2005-01-06 20:21 ` cvs-commit at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-06 20:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-06 20:21 -------
Subject: Bug 19244

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-01-06 20:21:16

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog class.c decl.c method.c parser.c 
Added files:
	gcc/testsuite/g++.dg/parse: ctor2.C 

Log message:
	PR c++/19244
	* class.c (add_implicitly_declared_members): Remove dead code.
	* decl.c (grokfndecl): Add sfk parameter.  Use it do set
	DECL_CONSTRUCTOR_P.
	(grokdeclarator): Adjust calls to grokfndecl.
	* method.c (implicitly_declare_fn): Improve documentation.
	* parser.c (cp_parser_direct_declarator): Do not consider a
	function to be a constructor if the containing class was
	originally anonymous.
	
	PR c++/19244
	* g++.dg/parser/ctor2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4856&r2=1.4857
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/ctor2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4571&r2=1.4572
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.698&r2=1.699
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1351&r2=1.1352
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&r1=1.318&r2=1.319
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.301&r2=1.302



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19244


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-01-06 20:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-03 21:00 [Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition austern at apple dot com
2005-01-03 21:07 ` [Bug c++/19244] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-01-04 15:50 ` pinskia at gcc dot gnu dot org
2005-01-06 16:38 ` mmitchel at gcc dot gnu dot org
2005-01-06 20:21 ` mmitchel at gcc dot gnu dot org
2005-01-06 20:21 ` cvs-commit at gcc dot gnu dot 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).