This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12387] ICE with typeof as template parameter
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Sep 2003 16:56:19 -0000
- Subject: [Bug c++/12387] ICE with typeof as template parameter
- References: <20030924075636.12387.igodard@pacbell.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12387
reichelt at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |ice-on-valid-code, monitored
Last reconfirmed|0000-00-00 00:00:00 |2003-09-25 16:56:17
date| |
Summary|ICE |ICE with typeof as template
| |parameter
------- Additional Comments From reichelt at gcc dot gnu dot org 2003-09-25 16:56 -------
This is just another typeof-in-template-parameters issue
(although I didn't find an exact duplicate).
A reduced (and valid) testcase would be:
========================================
template<typename T> struct A
{
typedef T X;
};
template<typename T> void foo(T t)
{
typename A<typeof(t)>::X::Y Y;
}
========================================
Alas, this crashes every version since gcc 2.95.x. :-(
With 3.3 branch I get:
bug.ii: In function `void foo(T)':
bug.ii:9: internal compiler error: in lookup_member, at cp/search.c:1498
Please submit a full bug report,
With mainline I get:
bug.ii: In function `void foo(T)':
bug.ii:9: error: no type named `X' in `struct A<__typeof (t)>'
bug.ii:9: internal compiler error: tree check: expected class 't', have 'x'
(error_mark) in cp_parser_class_name, at cp/parser.c:11156
Replacing "typeof(t)" by "T" makes the code compile.
This also applies to the original testcase: Just replace
"typeof(ser)" by "Ser" and the ICE is gone. If you fix the
remaining errors (missing typenames in these lines, and a
couple of typos scattered through the source), the code compiles
with 3.3 branch.