This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/9781: ICE in cp_parser_template_id
- From: bangerth at ticam dot utexas dot edu
- To: gcc-gnats at gcc dot gnu dot org
- Date: 20 Feb 2003 20:22:57 -0000
- Subject: c++/9781: ICE in cp_parser_template_id
- Reply-to: bangerth at ticam dot utexas dot edu
>Number: 9781
>Category: c++
>Synopsis: ICE in cp_parser_template_id
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: unassigned
>State: open
>Class: ice-on-illegal-code
>Submitter-Id: net
>Arrival-Date: Thu Feb 20 20:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Wolfgang Bangerth
>Release: unknown-1.0
>Organization:
>Environment:
>Description:
Found while tracking 9779:
This illegal piece of code generates an ICE in all
versions of gcc since at least 2.95:
----------------------------
template<bool> void foo(BOGUS) {
sizeof (BOGUS);
}
template void foo<true>(BOGUS);
-----------------------------
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c z.cc
z.cc:1: error: variable or field `foo' declared void
z.cc:1: error: template declaration of `int foo'
z.cc:1: error: `BOGUS' has not been declared
z.cc:1: error: expected expected `;'
z.cc:4: internal compiler error: in cp_parser_template_id, at cp/parser.c:7996
Please submit a full bug report,
Since the code is obviously bogus, and the ICE is after
an error message, the priority is as low as could possibly
be. Nevertheless, if someone wants to fix this: a backtrace
is as this one:
#0 cp_parser_template_id (parser=0x40192080, template_keyword_p=false,
check_dependency_p=96) at ../../gcc-3.4-CVS/gcc/cp/parser.c:7996
#1 0x080f976e in cp_parser_class_name (parser=0x40192080,
typename_keyword_p=false, template_keyword_p=false, type_p=false,
check_access_p=true, check_dependency_p=true, class_head_p=false)
at ../../gcc-3.4-CVS/gcc/cp/parser.c:11363
#2 0x080f1ceb in cp_parser_class_or_namespace_name (parser=0x40192080,
typename_keyword_p=false, template_keyword_p=false,
check_dependency_p=true, type_p=false)
at ../../gcc-3.4-CVS/gcc/cp/parser.c:3489
#3 0x080f194f in cp_parser_nested_name_specifier_opt (parser=0x40192080,
typename_keyword_p=false, check_dependency_p=true, type_p=false)
at ../../gcc-3.4-CVS/gcc/cp/parser.c:3301
At the spot where it aborts is this:
/* If it's not a class-template or a template-template, it should be
a function-template. */
my_friendly_assert ((DECL_FUNCTION_TEMPLATE_P (template)
|| TREE_CODE (template) == OVERLOAD
|| BASELINK_P (template)),
20010716);
W.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: