Bug 12132 - [3.4 regression] spurious "int ._0" (or "int $_0) in error message
Summary: [3.4 regression] spurious "int ._0" (or "int $_0) in error message
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 minor
Target Milestone: 3.4.0
Assignee: Mark Mitchell
URL:
Keywords: diagnostic
: 12135 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-09-02 13:52 UTC by Volker Reichelt
Modified: 2004-01-17 04:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-12-21 10:01:49


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2003-09-02 13:52:16 UTC
Compiling the invalid code snippet

--------------------------------------------
inline template <int> void foo () {}
--------------------------------------------

with mainline, I get the following error message:

  bug.cc:1: error: expected unqualified-id
  bug.cc:1: error: ISO C++ forbids declaration of `type name' with no type
  bug.cc:1: error: abstract declarator `int' used as declaration
  bug.cc:1: error: explicit instantiation of non-template `int ._0'
  bug.cc:1: error: expected `;'

which is bogus. The worst part is "int ._0" which is nowhere to be
seen in the code. The rest isn't very helpful either.

Previous versions of gcc just gave a simple

  bug.cc:1: error: parse error before `<' token

which isn't very elaborate, but not as confusing as mainline's message.


Btw, 3.3 branch issues an ICE when compiling the following code
(one can use any name of a builtin instead of abort):

--------------------------------------------
inline template <int> void foo () {}
void abort ();
--------------------------------------------

The error message then is:

  bug.cc:1: error: parse error before `<' token
  bug.cc:3: internal compiler error: in lookup_template_function, at
cp/pt.c:         4002
  Please submit a full bug report, [etc.]

But since this is an error-recovery problem which is fixed on mainline,
there's nothing more to do about the ICE.
Comment 1 Volker Reichelt 2003-09-02 17:01:02 UTC
*** Bug 12135 has been marked as a duplicate of this bug. ***
Comment 2 Wolfgang Bangerth 2003-09-02 19:53:11 UTC
Correct.
Comment 3 Andrew Pinski 2003-09-02 20:56:59 UTC
Related to bug 6259 and bug 9050.
Comment 4 Andrew Pinski 2003-09-07 05:03:28 UTC
On the mainline (20030907) on PPC Darwin, gcc gives a silightly different error 
message:
pr12132.cc:2: error: expected unqualified-id
pr12132.cc:2: error: ISO C++ forbids declaration of `type name' with no type
pr12132.cc:2: error: abstract declarator `int' used as declaration
pr12132.cc:2: error: explicit instantiation of non-template `int $_0'
pr12132.cc:2: error: expected `;'
Comment 5 GCC Commits 2004-01-05 21:07:25 UTC
Subject: Bug 12132

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-01-05 21:07:22

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: error11.C 

Log message:
	PR c++/12132
	* parser.c (cp_parser_explicit_instantiation): Improve error
	recovery.
	(cp_parser_require): Improve indication of the error location.
	
	PR c++/12132
	* g++.dg/template/error11.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3855&r2=1.3856
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.146&r2=1.147
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3337&r2=1.3338
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error11.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 Mark Mitchell 2004-01-05 21:08:48 UTC
Fixed in GCC 3.4.