Bug 10527 - [3.3/3.4 regression] confused error message with "new int()" parameter initializer
Summary: [3.3/3.4 regression] confused error message with "new int()" parameter initia...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P3 normal
Target Milestone: 3.3.1
Assignee: Mark Mitchell
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2003-04-28 21:46 UTC by rcampbell
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
a.ii (79.32 KB, text/x-c++)
2003-05-21 15:17 UTC, rcampbell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rcampbell 2003-04-28 21:46:01 UTC
Internal error while compiling some (fairly) complicated template code.

Release:
3.3/3.4

Environment:
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs
Configured with: /netrel/src/gcc-3.2-3/configure --enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin
Thread model: posix
gcc version 3.2 20020927 (prerelease)

How-To-Repeat:
g++ -save-temps -W -Wall a.cc -o a.exe
Comment 2 Giovanni Bajo 2003-04-29 12:45:06 UTC
From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-gnats@gcc.gnu.org>,
	<Endlisnis@mailc.net>,
	<gcc-bugs@gcc.gnu.org>,
	<rcampbell@tropicnetworks.com>,
	<nobody@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>
Cc: "Wolfgang Bangerth" <bangerth@ices.utexas.edu>
Subject: Re: c++/10527: Internal error during template compile
Date: Tue, 29 Apr 2003 12:45:06 +0200

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 r=10527
 
 Confirmed. Reduced snippet is:
 ------------------------------------------------------------
 template <class T>
 struct Foo
 {};
 
 template <class T>
 void Foo<T>::NON_EXISTENT(int* val = new int())
 {}
 
 ------------------------------------------------------------
 pr10527.cpp:7: error: no `
 Internal compiler error: Error reporting routines re-entered.
 Please submit a full bug report,
 
 This is ice-on-illegal-code, 3.3/3.4 regression with respect to 2.95 where
 the same code shows a correct error message.
 
 Note that if Foo is a normal class, the ICE disappears but the error message
 is _ugly_:
 
 ------------------------------------------------------------
 struct Foo
 {};
 
 void Foo::NON_EXISTENT(int* val = new int())
 {}
 
 ------------------------------------------------------------
 pr10527.cpp:5: error: no `void Foo::NON_EXISTENT(int* = (operator
 new(unsigned
    int)(4), ((true, (((*<anonymous>) <unknown operator> 0), (<anonymous>
    <unknown operator> false))), <anonymous>)))' member function declared in
    class `Foo'
 
 For the original poster, your code is illegal for several reasons. First,
 the parameter list of your makeQueryHandler() function at definition time
 does not match the parameter list at declaration time. Then, if you want to
 define a template member function of a template class outside the class
 definition, the syntax you must use is the following:
 
 template <class-template-parameters>
 struct Foo
 {
     template <memfun-template-parameters>
     void func(..........);
 };
 
 template <class-template-parameters>
 template <memfun-template-paramters>
 void Foo<class-template-parameter-names>::func(.......)
 {
    .....
 }
 
 
 Hope this helps
 Giovanni Bajo
 
Comment 3 Wolfgang Bangerth 2003-04-29 14:13:31 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: See Giovanni's mail (when will he finally get his GNATS
    account???)
Comment 4 Mark Mitchell 2003-04-29 20:15:37 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10527
Date: 29 Apr 2003 20:15:37 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	mmitchel@gcc.gnu.org	2003-04-29 20:15:37
 
 Modified files:
 	gcc/cp         : ChangeLog error.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/init: new7.C 
 
 Log message:
 	PR c++/10527
 	* error.c (dump_expr): Correctly handling of NEW_EXPR.4
 	
 	PR c++/10527
 	* g++.dg/init/new7.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.123&r2=1.3076.2.124
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.192.2.3&r2=1.192.2.4
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.160&r2=1.2261.2.161
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 

Comment 5 Mark Mitchell 2003-04-29 20:15:37 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10527
Date: 29 Apr 2003 20:15:37 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	mmitchel@gcc.gnu.org	2003-04-29 20:15:37
 
 Modified files:
 	gcc/cp         : ChangeLog error.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/init: new7.C 
 
 Log message:
 	PR c++/10527
 	* error.c (dump_expr): Correctly handling of NEW_EXPR.4
 	
 	PR c++/10527
 	* g++.dg/init/new7.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.123&r2=1.3076.2.124
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.192.2.3&r2=1.192.2.4
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.160&r2=1.2261.2.161
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 
Comment 6 Mark Mitchell 2003-04-29 20:17:00 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10527
Date: 29 Apr 2003 20:17:00 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-04-29 20:17:00
 
 Modified files:
 	gcc/cp         : ChangeLog error.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/init: new7.C 
 
 Log message:
 	PR c++/10527
 	* error.c (dump_expr): Correctly handling of NEW_EXPR.4
 	
 	PR c++/10527
 	* g++.dg/init/new7.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3349&r2=1.3350
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.203&r2=1.204
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2632&r2=1.2633
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new7.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
 

Comment 7 Mark Mitchell 2003-04-29 20:17:00 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10527
Date: 29 Apr 2003 20:17:00 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-04-29 20:17:00
 
 Modified files:
 	gcc/cp         : ChangeLog error.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/init: new7.C 
 
 Log message:
 	PR c++/10527
 	* error.c (dump_expr): Correctly handling of NEW_EXPR.4
 	
 	PR c++/10527
 	* g++.dg/init/new7.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3349&r2=1.3350
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.203&r2=1.204
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2632&r2=1.2633
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new7.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
 
Comment 8 Mark Mitchell 2003-04-29 20:18:42 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.3, GCC 3.4.
Comment 9 Giovanni Bajo 2003-04-30 13:52:42 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: He fixed the ICE here, probably it's something related
Comment 10 Giovanni Bajo 2003-04-30 13:52:42 UTC
State-Changed-From-To: closed->analyzed
State-Changed-Why: The problem with the wrong error message is still present:
    
    -----------------------------------------------
    struct Foo
    {};
    
    void Foo::NON_EXISTENT(int* val = new int())
    {}
    -----------------------------------------------
    pr10527.cpp:7: error: no `void Foo::NON_EXISTENT(int* = (operator new(unsigned
       int)(4), ((true, (((*<anonymous>) <unknown operator> 0), (<anonymous>
       <unknown operator> false))), <anonymous>)))' member function declared in
       class `Foo'
    
    
    This is a regression since 2.95, where we got:
    
    pr10527.cpp:7: no `void Foo::NON_EXISTENT(int * = new int)' member function 
    declared in class `Foo'
    
    
    Since it's simply a regression on error message formatting, I lower the priority.
Comment 11 CVS Commits 2003-07-10 16:47:58 UTC
Subject: Bug 10527

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-07-10 16:47:52

Modified files:
	gcc            : ChangeLog 
	gcc/doc        : invoke.texi 
	gcc/cp         : ChangeLog cp-tree.h decl.c error.c tree.c 
	                 typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/warn: pedantic1.C 

Log message:
	PR c++/10032
	* doc/invoke.texi (C++ Dialect Options): Change documentation of
	-fpermissive.
	
	PR c++/10032
	* decl.c (cxx_init_decl_processing): With -pedantic, pedwarns are
	still errors.
	
	PR c++/10527
	* error.c (decl_to_string): Do not print default argument
	expressions.
	
	* cp-tree.h (break_out_calls): Remove declaration.
	* tree.c (break_out_calls): Remove.
	* typeck.c (build_modify_expr): Avoid invalid sharing of trees.
	
	PR c++/10032
	* g++.dg/warn/pedantic1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.439&r2=2.440
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.315&r2=1.316
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3506&r2=1.3507
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.871&r2=1.872
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1085&r2=1.1086
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.220&r2=1.221
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.335&r2=1.336
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.478&r2=1.479
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2860&r2=1.2861
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/pedantic1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 12 CVS Commits 2003-07-10 17:05:34 UTC
Subject: Bug 10527

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	mmitchel@gcc.gnu.org	2003-07-10 17:05:28

Modified files:
	gcc            : ChangeLog 
	gcc/doc        : invoke.texi 
	gcc/cp         : ChangeLog decl.c error.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/warn: pedantic1.C 

Log message:
	PR c++/10032
	* doc/invoke.texi (C++ Dialect Options): Change documentation of
	-fpermissive.
	
	PR c++/10032
	* decl.c (cxx_init_decl_processing): With -pedantic, pedwarns are
	still errors.
	
	PR c++/10527
	* error.c (decl_to_string): Do not print default argument
	expressions.
	
	PR c++/10032
	* g++.dg/warn/pedantic1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.646&r2=1.16114.2.647
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.209.2.39&r2=1.209.2.40
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.177&r2=1.3076.2.178
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.965.2.53&r2=1.965.2.54
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.192.2.6&r2=1.192.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.224&r2=1.2261.2.225
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/pedantic1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1

Comment 13 Mark Mitchell 2003-07-10 17:06:22 UTC
Fixed in GCC 3.3.1, GCC 3.4 with attached patch.