[Bug c++/45894] [4.5/4.6 Regression] [C++0x] ICE: segmentation fault with -Wall
dodji at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 8 14:28:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45894
--- Comment #5 from Dodji Seketeli <dodji at gcc dot gnu.org> 2010-11-08 14:27:46 UTC ---
I think the example is invalid in c++ 2003 as [temp.param/9] says that
a function template shall not have any default template argument. It's
valid in c++0x though as that rule has been relaxed.
FWIW, Trying the code with without -Wall and with c++0x is accepted by
current trunk. -Wall with -std=c++0x crashes it too. Without -Wall and
without -std=c++0x the code is rejected by trunk.
The crash happens while looking at the expression FOO::BAR<> because
we want to emit warnings about variables access in undefined
sequencing conditions. For that finish_expr_stmt passes the expression
FOO::Bar<> (represented as the BASELINK Jakub referred to), to
verify_sequence_points which at some point tries to see if the
TEMPLATE_ID_EXPR representing FOO::BAR<> is an lvalue. Then
lvalue_kind crashes because it doesn't expect a tree without a TYPE
[TEMPLATE_ID_EXPR doesn't have a type] as Jakub noted.
I think the fix looks correct (assuming it passes regtests), as it
1/robustifies lvalue_kind
2/makes it return clk_none and IMHO rightfully so as we can't say at
this point if the TEMPLATE_ID_EXPR (which is just a syntactic
representation) is an lvalue or not. To be able to decide on the
lvalueness we'd need something more typed at this point, I suppose.
More information about the Gcc-bugs
mailing list