Bug 59114 - [c++1y] ICE using auto in conversion operator
Summary: [c++1y] ICE using auto in conversion operator
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-13 14:39 UTC by Volker Reichelt
Modified: 2014-11-26 16:10 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2013-11-13 14:39:04 UTC
The following invalid code snippet (compiled with "-std=c++1y") triggers an ICE since GCC 4.8.0:

=======================================
template<int> struct A
{
  template<typename T> operator T();
};

void foo()
{
  A<0>().operator auto();
}
=======================================

bug.cc: In function 'void foo()':
bug.cc:8:24: internal compiler error: in push_access_scope, at cp/pt.c:220
   A<0>().operator auto();
                        ^
0x591647 push_access_scope
        ../../gcc/gcc/cp/pt.c:219
0x5e266c fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc/gcc/cp/pt.c:15679
0x54d05c add_template_candidate_real
        ../../gcc/gcc/cp/call.c:2923
0x548ce9 add_template_candidate
        ../../gcc/gcc/cp/call.c:3020
0x548ce9 add_candidates
        ../../gcc/gcc/cp/call.c:5075
0x550617 build_new_method_call_1
        ../../gcc/gcc/cp/call.c:7698
0x550617 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc/gcc/cp/call.c:7884
0x652842 cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.c:6065
0x6548cd cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:7100
0x65543f cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:7804
0x65590f cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8042
0x657e63 cp_parser_expression
        ../../gcc/gcc/cp/parser.c:8204
0x65865e cp_parser_expression
        ../../gcc/gcc/cp/parser.c:8243
0x65865e cp_parser_expression_statement
        ../../gcc/gcc/cp/parser.c:9542
0x64df67 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9393
0x64ec49 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9665
0x64edbe cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9619
0x66248b cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18525
0x66248b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18561
0x6662c3 cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22593
Please submit a full bug report, [etc.]
Comment 1 Volker Reichelt 2014-03-18 20:33:48 UTC
The testcase doesn't fail anymore since 2014-03-08.
Jason, I suspect that this is due to your changes on the day before.
Do you want to add this testcase to the testsuite?
Comment 2 Jakub Jelinek 2014-03-19 07:30:12 UTC
This one got fixed with r208414.
Comment 3 Paolo Carlini 2014-11-26 16:00:05 UTC
Let's add the testcase and close the bug.
Comment 4 paolo@gcc.gnu.org 2014-11-26 16:07:25 UTC
Author: paolo
Date: Wed Nov 26 16:06:53 2014
New Revision: 218090

URL: https://gcc.gnu.org/viewcvs?rev=218090&root=gcc&view=rev
Log:
2014-11-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59114
	* g++.dg/cpp0x/auto43.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/auto43.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 5 Paolo Carlini 2014-11-26 16:10:27 UTC
Done.