10527 – [3.3/3.4 regression] confused error message with "new int()" parameter initializer (original) (raw)

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 struct Foo {}; template void Foo::NON_EXISTENT(int* val = new int()) {}

[pr10527](show%5Fbug.cgi?id=10527 "RESOLVED FIXED - [3.3/3.4 regression] confused error message with "new int()" parameter initializer").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](show%5Fbug.cgi?id=10527 "RESOLVED FIXED - [3.3/3.4 regression] confused error message with "new int()" parameter initializer").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 struct Foo { template void func(..........); };

template template void Foo::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 8 Mark Mitchell 2003-04-29 20🔞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](show%5Fbug.cgi?id=10527 "RESOLVED FIXED - [3.3/3.4 regression] confused error message with "new int()" parameter initializer").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](show%5Fbug.cgi?id=10527 "RESOLVED FIXED - [3.3/3.4 regression] confused error message with "new int()" parameter initializer").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 13 Mark Mitchell 2003-07-10 17:06:22 UTC

Fixed in GCC 3.3.1, GCC 3.4 with attached patch.