public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14361] New: Accepting invalid code with weird default parameter trailer.
@ 2004-03-01  9:38 mattyt-bugzilla at tpg dot com dot au
  2004-03-01  9:55 ` [Bug c++/14361] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mattyt-bugzilla at tpg dot com dot au @ 2004-03-01  9:38 UTC (permalink / raw)
  To: gcc-bugs

The code:

class A {
   A ( int n=0 int n );
};

compiles in G++-3.4, but shouldn't, as I understand it.

-- 
           Summary: Accepting invalid code with weird default parameter
                    trailer.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mattyt-bugzilla at tpg dot com dot au
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/14361] Accepting invalid code with weird default parameter trailer.
  2004-03-01  9:38 [Bug c++/14361] New: Accepting invalid code with weird default parameter trailer mattyt-bugzilla at tpg dot com dot au
@ 2004-03-01  9:55 ` pinskia at gcc dot gnu dot org
  2004-03-01 21:10 ` [Bug c++/14361] [3.4/3.5 Regression] " mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-01  9:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-01 09:55 -------
Confirmed a regression from 3.3.1, also note it is even worse than that.
this is accepted:
struct A {
   A ( int n=0 ,int n1 );
};

And this is too:
struct A {
   A ( int n=0 i );
};

Looks the parser is ignorning anything after the default argument until the ')' token.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.1
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-01 09:55:36
               date|                            |
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/14361] [3.4/3.5 Regression] Accepting invalid code with weird default parameter trailer.
  2004-03-01  9:38 [Bug c++/14361] New: Accepting invalid code with weird default parameter trailer mattyt-bugzilla at tpg dot com dot au
  2004-03-01  9:55 ` [Bug c++/14361] " pinskia at gcc dot gnu dot org
@ 2004-03-01 21:10 ` mmitchel at gcc dot gnu dot org
  2004-03-02  2:00 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-03-01 21:10 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=14361


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

* [Bug c++/14361] [3.4/3.5 Regression] Accepting invalid code with weird default parameter trailer.
  2004-03-01  9:38 [Bug c++/14361] New: Accepting invalid code with weird default parameter trailer mattyt-bugzilla at tpg dot com dot au
  2004-03-01  9:55 ` [Bug c++/14361] " pinskia at gcc dot gnu dot org
  2004-03-01 21:10 ` [Bug c++/14361] [3.4/3.5 Regression] " mmitchel at gcc dot gnu dot org
@ 2004-03-02  2:00 ` cvs-commit at gcc dot gnu dot org
  2004-03-02  2:06 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-02  2:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-02 02:00 -------
Subject: Bug 14361

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-03-02 02:00:06

Modified files:
	gcc/cp         : ChangeLog decl.c parser.c pt.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.old-deja/g++.ns: koenig5.C 
Added files:
	gcc/testsuite/g++.dg/parse: defarg7.C 
	gcc/testsuite/g++.dg/template: friend26.C 

Log message:
	PR c++/14360
	* parser.c (cp_parser_postfix_expression): Do not perform Koenig
	lookup if ordinary name-lookup finds a non-function.
	* pt.c (tsubst_copy_and_build): Likewise.
	
	PR c++/14361
	* parser.c (cp_parser_late_parsing_default_args): Check that there
	are no extra tokens after the end of the default-argument
	expression.
	
	Backport 2004-02-12  Mark Mitchell  <mark@codesourcery.com>
	* decl.c (redeclaration_error_message): Correct handling of
	templates.
	* pt.c (tsubst_friend_declaration): Adjust code to determine
	whether or not a friend template is a definition.
	(tsubst_decl): Clear DECL_INITIAL for new FUNCTION_DECLs.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.65&r2=1.3892.2.66
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.10&r2=1.1174.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.17&r2=1.157.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.15&r2=1.816.2.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.115&r2=1.3389.2.116
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/defarg7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend26.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.ns/koenig5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3&r2=1.3.16.1



-- 


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


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

* [Bug c++/14361] [3.4/3.5 Regression] Accepting invalid code with weird default parameter trailer.
  2004-03-01  9:38 [Bug c++/14361] New: Accepting invalid code with weird default parameter trailer mattyt-bugzilla at tpg dot com dot au
                   ` (2 preceding siblings ...)
  2004-03-02  2:00 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-02  2:06 ` mmitchel at gcc dot gnu dot org
  2004-03-02  2:06 ` cvs-commit at gcc dot gnu dot org
  2004-03-02  2:07 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-03-02  2:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-03-02 02:06 -------
Fixed in GCC 3.4 and GCC 3.5.

-- 


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


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

* [Bug c++/14361] [3.4/3.5 Regression] Accepting invalid code with weird default parameter trailer.
  2004-03-01  9:38 [Bug c++/14361] New: Accepting invalid code with weird default parameter trailer mattyt-bugzilla at tpg dot com dot au
                   ` (3 preceding siblings ...)
  2004-03-02  2:06 ` mmitchel at gcc dot gnu dot org
@ 2004-03-02  2:06 ` cvs-commit at gcc dot gnu dot org
  2004-03-02  2:07 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-02  2:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-02 02:06 -------
Subject: Bug 14361

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-03-02 02:06:18

Modified files:
	gcc/cp         : ChangeLog parser.c pt.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.old-deja/g++.ns: koenig5.C 
Added files:
	gcc/testsuite/g++.dg/parse: defarg7.C 
	gcc/testsuite/g++.dg/template: friend26.C 

Log message:
	PR c++/14360
	* parser.c (cp_parser_postfix_expression): Do not perform Koenig
	lookup if ordinary name-lookup finds a non-function.
	* pt.c (tsubst_copy_and_build): Likewise.
	
	PR c++/14361
	* parser.c (cp_parser_late_parsing_default_args): Check that there
	are no extra tokens after the end of the default-argument
	expression.
	
	PR c++/14360
	* g++.old-deja/g++.ns/koenig5.C: Remove some error markers.
	
	PR c++/14361
	* g++.dg/parse/defarg7.C: New test.
	
	PR c++/14359
	* g++.dg/template/friend26.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3981&r2=1.3982
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.178&r2=1.179
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.834&r2=1.835
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3560&r2=1.3561
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/defarg7.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend26.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.ns/koenig5.C.diff?cvsroot=gcc&r1=1.3&r2=1.4



-- 


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


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

* [Bug c++/14361] [3.4/3.5 Regression] Accepting invalid code with weird default parameter trailer.
  2004-03-01  9:38 [Bug c++/14361] New: Accepting invalid code with weird default parameter trailer mattyt-bugzilla at tpg dot com dot au
                   ` (4 preceding siblings ...)
  2004-03-02  2:06 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-02  2:07 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-03-02  2:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-03-02 02:07 -------
Fixed in GCC 3.4 and GCC 3.5.

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


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


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

end of thread, other threads:[~2004-03-02  2:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-01  9:38 [Bug c++/14361] New: Accepting invalid code with weird default parameter trailer mattyt-bugzilla at tpg dot com dot au
2004-03-01  9:55 ` [Bug c++/14361] " pinskia at gcc dot gnu dot org
2004-03-01 21:10 ` [Bug c++/14361] [3.4/3.5 Regression] " mmitchel at gcc dot gnu dot org
2004-03-02  2:00 ` cvs-commit at gcc dot gnu dot org
2004-03-02  2:06 ` mmitchel at gcc dot gnu dot org
2004-03-02  2:06 ` cvs-commit at gcc dot gnu dot org
2004-03-02  2:07 ` mmitchel 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).