public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58503] New: ICE with invalid range in range-based for-loop
@ 2013-09-22 19:07 reichelt at gcc dot gnu.org
2013-10-03 9:26 ` [Bug c++/58503] [c++11] " paolo.carlini at oracle dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-09-22 19:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58503
Bug ID: 58503
Summary: ICE with invalid range in range-based for-loop
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following invalid code snippet (compiled with "-std=c++0x") triggers an ICE
since GCC 4.7.0:
===================================
template<int> void foo()
{
for (auto i : 0) {}
}
===================================
bug.cc: In function 'void foo()':
bug.cc:3:17: error: there are no arguments to 'begin' that depend on a template
parameter, so a declaration of 'begin' must be available [-fpermissive]
for (auto i : 0) {}
^
bug.cc:3:17: note: (if you use '-fpermissive', G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
bug.cc:3:17: error: there are no arguments to 'end' that depend on a template
parameter, so a declaration of 'end' must be available [-fpermissive]
bug.cc:3:17: internal compiler error: Segmentation fault
0xae93df crash_signal
../../gcc/gcc/toplev.c:335
0xcd77b0 strip_array_types(tree_node*)
../../gcc/gcc/tree.c:7815
0x65eba8 cp_type_quals(tree_node const*)
../../gcc/gcc/cp/typeck.c:8745
0x6cb5e4 cv_unqualified(tree_node*)
../../gcc/gcc/cp/tree.c:1144
0x62c8d0 cp_parser_perform_range_for_lookup
../../gcc/gcc/cp/parser.c:10176
0x6369c4 do_range_for_auto_deduction
../../gcc/gcc/cp/parser.c:9962
0x6369c4 cp_parser_range_for
../../gcc/gcc/cp/parser.c:9915
0x6369c4 cp_parser_for
../../gcc/gcc/cp/parser.c:9848
0x6369c4 cp_parser_iteration_statement
../../gcc/gcc/cp/parser.c:10295
0x6369c4 cp_parser_statement
../../gcc/gcc/cp/parser.c:9175
0x636dfe cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:9552
0x636f46 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:9506
0x648343 cp_parser_function_body
../../gcc/gcc/cp/parser.c:18313
0x648343 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:18349
0x64937f cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:22333
0x64a099 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:22254
0x64a099 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:16348
0x64a994 cp_parser_single_declaration
../../gcc/gcc/cp/parser.c:22647
0x64d560 cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:22449
0x655301 cp_parser_declaration
../../gcc/gcc/cp/parser.c:10728
Please submit a full bug report, [etc.]
When the "-fpermissive" option is added, there is no error (only warnings)
before the ICE.
The code is wrongly accepted by GCC 4.6.x.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-04 23:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-22 19:07 [Bug c++/58503] New: ICE with invalid range in range-based for-loop reichelt at gcc dot gnu.org
2013-10-03 9:26 ` [Bug c++/58503] [c++11] " paolo.carlini at oracle dot com
2013-10-04 23:17 ` paolo at gcc dot gnu.org
2013-10-04 23:18 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).