Bug 19608 - ICE after friend function definition in local class
Summary: ICE after friend function definition in local class
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 minor
Target Milestone: 3.4.5
Assignee: Nathan Sidwell
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2005-01-24 19:24 UTC by Jorn Wolfgang Rennecke
Modified: 2005-06-09 07:49 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build: i686-pc-linux-gnu
Known to work: 3.3 3.3.5
Known to fail: 3.0 3.2.3 3.4.0 4.0.0
Last reconfirmed: 2005-02-26 18:42:30


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2005-01-24 19:24:29 UTC
bash-2.05b$ cat friend.c
void f ()
{
  class c
    {
      friend void g () { }
    };
}
bash-2.05b$ ./cc1plus friend.c
 void f()

friend.c:5: error: can't define friend function ‘g’ in a local class definition
 void g()

friend.c: At global scope:
friend.c:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
bash-2.05b$ ./cc1plus --version
GNU C++ version 4.0.0 20050124 (experimental) (sh-elf)
        compiled by GNU C version 3.2.3 20030502 (Red Hat Linux 3.2.3-42).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

I gte the same error with an i686-targted compiler from an August snapshot.
Comment 1 Andrew Pinski 2005-01-24 19:30:24 UTC
: Search converges between 2003-03-23-trunk (#215) and 2003-03-30-trunk (#216).

Confirmed. A regression from 3.3.3.
Comment 2 CVS Commits 2005-02-14 17:51:09 UTC
Subject: Bug 19608

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2005-02-14 17:50:59

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: local-class1.C 

Log message:
	cp:
	PR c++/19608
	* parser.c (cp_parser_late_parsing_for_member): Use
	current_function_decl as scope to push to and from.
	testsuite:
	PR c++/19608
	* g++.dg/parse/local-class1.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4628&r2=1.4629
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.315&r2=1.316
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5031&r2=1.5032
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/local-class1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 3 Nathan Sidwell 2005-02-14 17:53:26 UTC
2005-02-14  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/19608
	* parser.c (cp_parser_late_parsing_for_member): Use
	current_function_decl as scope to push to and from.
Comment 4 Volker Reichelt 2005-02-15 12:32:08 UTC
Not fixed on 3.4 branch.
Comment 5 CVS Commits 2005-06-09 07:46:51 UTC
Subject: Bug 19608

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	nathan@gcc.gnu.org	2005-06-09 07:46:23

Modified files:
	gcc/cp         : ChangeLog cp-tree.def parser.c pt.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.old-deja/g++.oliva: template6.C 
Added files:
	gcc/testsuite/g++.dg/parse: local-class1.C defarg9.C 
	gcc/testsuite/g++.dg/template: explicit6.C 

Log message:
	cp:
	PR c++/21903
	* cp-tree.def (DEFAULT_ARG): Document TREE_CHAIN use.
	* parser.c (cp_parser_late_parsing_default_args): Propagate parsed
	argument to any early instantiations.
	* pt.c (tsubst_arg_types): Chain early instantiation of default
	arg.
	
	PR c++/19884
	* pt.c (check_explicit_specialization): Make sure namespace
	binding lookup found an overloaded function.
	(lookup_template_function): Just assert FNS is an overloaded
	function.
	testsuite:
	PR c++/19608
	* parser.c (cp_parser_late_parsing_for_member): Use
	current_function_decl as scope to push to and from.
	testsuite:
	
	PR 21903
	* g++.dg/parse/defarg9.C: New.
	
	PR c++/19884
	* g++.old-deja/g++.oliva/template6.C: Add another case.
	* g++.dg/template/explicit6.C: New.
	
	PR c++/19608
	* g++.dg/parse/local-class1.C: New.

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.223&r2=1.3892.2.224
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.def.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.80&r2=1.80.10.1
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.56&r2=1.157.2.57
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.54&r2=1.816.2.55
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.403&r2=1.3389.2.404
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/local-class1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.28.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/defarg9.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/explicit6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.28.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.oliva/template6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3&r2=1.3.16.1

Comment 6 Nathan Sidwell 2005-06-09 07:49:05 UTC
Fixed on 3.4
2005-06-08  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/19608
	* parser.c (cp_parser_late_parsing_for_member): Use
	current_function_decl as scope to push to and from.
	testsuite: