Bug 40619 - [c++0x] ICE on repeated decltype expression in auto functions
Summary: [c++0x] ICE on repeated decltype expression in auto functions
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.4.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-02 14:41 UTC by Andrey Zholos
Modified: 2009-07-05 01:01 UTC (History)
2 users (show)

See Also:
Host: x86_64-portbld-freebsd7.2
Target: x86_64-portbld-freebsd7.2
Build: x86_64-portbld-freebsd7.2
Known to work:
Known to fail:
Last reconfirmed: 2009-07-02 14:59:07


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Zholos 2009-07-02 14:41:18 UTC
template<typename U> struct X {};

template<typename T> auto f(T t) -> X<decltype(t+1)> {}
template<typename T> auto g(T t) -> X<decltype(t+1)> {}


Compiling with -std=c++0x gives
decltype_ice.cc:4:52: internal compiler error: Segmentation fault: 11
Comment 1 Paolo Carlini 2009-07-02 14:59:07 UTC
Jason, can you have a look to this one? Thanks in advance!
Comment 2 Jason Merrill 2009-07-04 04:34:18 UTC
Subject: Bug 40619

Author: jason
Date: Sat Jul  4 04:34:03 2009
New Revision: 149223

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149223
Log:
	PR c++/40619
	* cp-tree.h (struct lang_decl_parm): New.
	(struct lang_decl): Add it.
	(LANG_DECL_PARM_CHECK): New.
	(DECL_PARM_INDEX): New.
	* decl2.c (parm_index): Remove.
	* lex.c (retrofit_lang_decl): Handle parms.
	(cxx_dup_lang_specific_decl): Likewise.
	* mangle.c (write_expression): Adjust.
	* tree.c (cp_tree_equal): Adjust.
	(decl_linkage): Only check DECL_COMDAT for functions and variables.
	* parser.c (cp_parser_parameter_declaration_list): Set
	DECL_PARM_INDEX.
	* pt.c (iterative_hash_template_arg): Hash it.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/auto16.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/lex.c
    trunk/gcc/cp/mangle.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/tree.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Paolo Carlini 2009-07-04 10:33:10 UTC
Thanks again Jason.
Comment 4 Andrey Zholos 2009-07-04 12:54:30 UTC
It works. Thanks!
Comment 5 Jason Merrill 2009-07-04 18:12:18 UTC
Subject: Bug 40619

Author: jason
Date: Sat Jul  4 18:11:59 2009
New Revision: 149240

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149240
Log:
	PR c++/40619
	* tree.c (cp_tree_equal) [PARM_DECL]: Don't check parm index.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto16.C
      - copied unchanged from r149223, trunk/gcc/testsuite/g++.dg/cpp0x/auto16.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/tree.c
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/   (props changed)
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C   (props changed)

Propchange: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/
            ('svn:mergeinfo' added)

Propchange: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C
            ('svn:mergeinfo' modified)


Comment 6 Jason Merrill 2009-07-05 01:01:00 UTC
Fixed for 4.4.1.