Bug 47208 - [4.6 Regression] [C++0x] ICE: in decl_constant_var_p, at cp/decl2.c:3563 with missing #include <initializer_list>
Summary: [4.6 Regression] [C++0x] ICE: in decl_constant_var_p, at cp/decl2.c:3563 with...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P2 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
: 47300 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-07 12:01 UTC by Zdenek Sojka
Modified: 2011-02-19 12:26 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.5.3
Known to fail: 4.6.0
Last reconfirmed: 2011-01-07 14:57:06


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2011-01-07 12:01:39 UTC
------ testcase.C ------
constexpr auto list = { };
static const int l = list.size();
------------------------

Compiler output:
$ gcc -std=c++0x testcase.C
testcase.C:1:25: error: deducing from brace-enclosed initializer list requires #include <initializer_list>
testcase.C:1:25: error: unable to deduce '<type error>' from '<brace-enclosed initializer list>()'
testcase.C:2:22: internal compiler error: in decl_constant_var_p, at cp/decl2.c:3563
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

(gdb) bt
#0  fancy_abort (file=0x1210188 "/usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/decl2.c", line=3563, 
    function=0x1211120 "decl_constant_var_p") at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/diagnostic.c:892
#1  0x00000000005b69b8 in decl_constant_var_p (decl=0x7ffff7ee71e0)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/decl2.c:3563
#2  0x0000000000644318 in finish_id_expression (id_expression=0x7ffff5cdaf78, decl=0x7ffff7ee71e0, scope=0x0, 
    idk=0x7fffffffd3fc, integral_constant_expression_p=1 '\001', allow_non_integral_constant_expression_p=1 '\001', 
    non_integral_constant_expression_p=0x7ffff5cdc0dd "", template_p=0 '\000', done=0 '\000', address_p=0 '\000', 
    template_arg_p=0 '\000', error_msg=0x7fffffffd378, location=238)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/semantics.c:3105
#3  0x00000000005d8fdc in cp_parser_primary_expression (parser=0x7ffff5cdc0b0, address_p=0 '\000', 
    cast_p=<value optimized out>, template_arg_p=0 '\000', idk=0x7fffffffd3fc)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:4005
#4  0x00000000005d9c40 in cp_parser_postfix_expression (parser=0x7ffff5cdc0b0, address_p=0 '\000', cast_p=0 '\000', 
    member_access_only_p=0 '\000', pidk_return=0x0) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:5163
#5  0x00000000005da8bb in cp_parser_unary_expression (parser=0x7ffff5cdc0b0, address_p=0 '\000', cast_p=0 '\000', pidk=0x0)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:6147
#6  0x00000000005db188 in cp_parser_binary_expression (parser=0x7ffff5cdc0b0, cast_p=<value optimized out>, 
    no_toplevel_fold_p=0 '\000', prec=PREC_NOT_OPERATOR, pidk=<value optimized out>)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:6817
#7  0x00000000005db6a3 in cp_parser_assignment_expression (parser=0x7ffff5cdc0b0, cast_p=0 '\000', pidk=0x0)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:7036
#8  0x00000000005dc0f9 in cp_parser_constant_expression (parser=0x7ffff5cdc0b0, allow_non_constant_p=<value optimized out>, 
    non_constant_p=0x7fffffffd71f "") at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:7261
#9  0x00000000005dc604 in cp_parser_initializer_clause (parser=<value optimized out>, non_constant_p=0x7fffffffd71f "")
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:16509
#10 cp_parser_initializer_clause (parser=<value optimized out>, non_constant_p=0x7fffffffd71f "")
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:16497
#11 0x00000000005e42dd in cp_parser_init_declarator (parser=0x7ffff5cdc0b0, decl_specifiers=0x7fffffffd780, checks=0x0, 
    function_definition_allowed_p=0 '\000', member_p=0 '\000', declares_class_or_enum=0, 
    function_definition_p=0x7fffffffd7ef "") at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:14683
#12 0x00000000005e987b in cp_parser_simple_declaration (parser=0x7ffff5cdc0b0, function_definition_allowed_p=1 '\001')
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9689
#13 0x00000000005e9be7 in cp_parser_block_declaration (parser=0x7ffff5cdc0b0, statement_p=0 '\000')
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9587
#14 cp_parser_block_declaration (parser=0x7ffff5cdc0b0, statement_p=0 '\000')
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9521
#15 0x00000000005ed8f2 in cp_parser_declaration (parser=0x7ffff5cdc0b0)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9492
#16 cp_parser_declaration (parser=0x7ffff5cdc0b0) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9399
#17 0x00000000005ec41a in cp_parser_declaration_seq_opt (parser=0x7ffff5cdc0b0)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9378
#18 0x00000000005edf69 in cp_parser_translation_unit () at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:3461
#19 c_parse_file () at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:25214
#20 0x00000000006c2195 in c_common_parse_file () at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/c-family/c-opts.c:1071
#21 0x0000000000a24598 in compile_file (argc=14, argv=0x7fffffffdab8)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:579
#22 do_compile (argc=14, argv=0x7fffffffdab8) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:1874
#23 toplev_main (argc=14, argv=0x7fffffffdab8) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:1937
#24 0x00007ffff6586bbd in __libc_start_main () from /lib/libc.so.6
#25 0x00000000004fef2d in _start ()


Tested revisions:
r168552 - crash
r165699 - OK
4.5 r168062 - OK
Comment 1 H.J. Lu 2011-01-07 14:57:06 UTC
It is caused by revision 166164:

http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00050.html
Comment 2 Dodji Seketeli 2011-02-18 08:48:00 UTC
Author: dodji
Date: Fri Feb 18 08:47:56 2011
New Revision: 170268

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170268
Log:
PR c++/47208

gcc/cp/

	PR c++/47208
	* pt.c (do_auto_deduction): Do not mention error_mark_node in
	diagnostics.
	* semantics.c (finish_id_expression): Do not pass erroneous decl
	to decl_constant_var_p.

gcc/testsuite/

	PR c++/47208
	* g++.dg/cpp0x/auto21.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/auto21.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Dodji Seketeli 2011-02-18 08:49:39 UTC
Fixed in trunk (4.6).
Comment 4 Zdenek Sojka 2011-02-19 12:26:37 UTC
*** Bug 47300 has been marked as a duplicate of this bug. ***