Bug 15227 - [3.3/3.4/4.0 regression] Trouble with invalid function definition
Summary: [3.3/3.4/4.0 regression] Trouble with invalid function definition
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.1
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2004-04-30 14:49 UTC by Volker Reichelt
Modified: 2004-10-07 23:42 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 2.95.3
Known to fail: 3.4.0 4.0.0 3.2.3 3.3.3
Last reconfirmed: 2004-04-30 15:00:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2004-04-30 14:49:11 UTC
The following testcase (which is invalid, as A::B doesn't exist)
causes trouble:

=============================================
template<typename> struct A {};

template<typename T> void A<T>::B::foo() {}
=============================================

GCC 2.95.3 correctly rejects the code,
gcc 3.1 - 3.3.4 wrongly accept it,
gcc 3.0.x, 3.4.0 and mainline segfault.
Comment 1 Andrew Pinski 2004-04-30 15:00:05 UTC
Confirmed.
Note 3.0.4 ICE after an error message (the same as 2.95.3):
tin:~/src/gnu/gcctest>~/ia32_linux_gcc3_0/bin/gcc pr15227.cc
pr15227.cc:3: syntax error before `::' token
pr15227.cc:3: confused by earlier errors, bailing out
Comment 2 Giovanni Bajo 2004-06-06 03:39:59 UTC
Retargeting to 3.4.1, being a regression on that release branch.
Comment 3 GCC Commits 2004-06-10 14:26:32 UTC
Subject: Bug 15227

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-06-10 14:26:23

Modified files:
	gcc/cp         : ChangeLog parser.c pt.c typeck.c 
Added files:
	gcc/testsuite/g++.dg/conversion: const1.C reinterpret1.C 
	gcc/testsuite/g++.dg/template: enum2.C error13.C 

Log message:
	PR c++/15227
	* parser.c (cp_parser_direct_declarator): Robustify.
	
	PR c++/15877
	* pt.c (tsubst_copy): Use decl_constant_value on enumeration
	constants in non-dependent contexts.
	
	PR c++/14211
	PR c++/15076
	* typeck.c (build_static_cast): Wrap casts in NON_LVALUE_EXPR when
	necessary.
	
	PR c++/14211
	* g++.dg/conversion/const1.C: New test.
	
	PR c++/15076
	* g++.dg/conversion/reinterpret1.C: New test.
	
	PR c++/15877
	* g++.dg/template/enum2.C: New test.
	
	PR c++/15227
	* g++.dg/template/error13.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4089&r2=1.4090
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.202&r2=1.203
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.860&r2=1.861
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.548&r2=1.549
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/conversion/const1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/conversion/reinterpret1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/enum2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error13.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 4 GCC Commits 2004-06-10 14:26:54 UTC
Subject: Bug 15227

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-06-10 14:26:50

Modified files:
	gcc/cp         : ChangeLog parser.c pt.c typeck.c 
Added files:
	gcc/testsuite/g++.dg/conversion: const1.C reinterpret1.C 
	gcc/testsuite/g++.dg/template: enum2.C error13.C 

Log message:
	PR c++/15227
	* parser.c (cp_parser_direct_declarator): Robustify.
	
	PR c++/15877
	* pt.c (tsubst_copy): Use decl_constant_value on enumeration
	constants in non-dependent contexts.
	
	PR c++/14211
	PR c++/15076
	* typeck.c (build_static_cast): Wrap casts in NON_LVALUE_EXPR when
	necessary.
	
	PR c++/14211
	* g++.dg/conversion/const1.C: New test.
	
	PR c++/15076
	* g++.dg/conversion/reinterpret1.C: New test.
	
	PR c++/15877
	* g++.dg/template/enum2.C: New test.
	
	PR c++/15227
	* g++.dg/template/error13.C: New test.

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.119&r2=1.3892.2.120
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.32&r2=1.157.2.33
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.29&r2=1.816.2.30
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.519.2.19&r2=1.519.2.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/conversion/const1.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/conversion/reinterpret1.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/enum2.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/error13.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 5 Mark Mitchell 2004-06-10 14:29:25 UTC
Fixed in GCC 3.4.1.
Comment 6 Andrew Pinski 2004-06-10 14:55:34 UTC
Fixed.