This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77790] New: ICE on valid C++14 code when compiling with "-std=c++11": in push_access_scope, at cp/pt.c:227


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77790

            Bug ID: 77790
           Summary: ICE on valid C++14 code when compiling with
                    "-std=c++11": in push_access_scope, at cp/pt.c:227
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

It appears to be a regression from 4.8.x, and affects 4.9.x and later. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160928 (experimental) [trunk revision 240585] (GCC)
$
$ g++-trunk -c -std=c++14 small.cpp
$
$ g++-trunk -c -std=c++11 small.cpp
small.cpp:3:42: error: ‘f’ function uses ‘auto’ type specifier without trailing
return type
   template < typename T > static auto f () { return 0; }
                                          ^
small.cpp:3:42: note: deduced return type only available with -std=c++14 or
-std=gnu++14
small.cpp:7:26: internal compiler error: in push_access_scope, at cp/pt.c:227
 auto a = A < int > {}.g ();
                          ^
0x6c2c37 push_access_scope
        ../../gcc-source-trunk/gcc/cp/pt.c:226
0x71e343 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:18004
0x67bfbb add_template_candidate_real
        ../../gcc-source-trunk/gcc/cp/call.c:3120
0x67ccec add_template_candidate
        ../../gcc-source-trunk/gcc/cp/call.c:3198
0x67ccec add_candidates
        ../../gcc-source-trunk/gcc/cp/call.c:5400
0x67d759 build_new_method_call_1
        ../../gcc-source-trunk/gcc/cp/call.c:8515
0x67d759 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc-source-trunk/gcc/cp/call.c:8714
0x79e483 cp_parser_postfix_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:6908
0x79c01c cp_parser_unary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8019
0x7a5e57 cp_parser_cast_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8696
0x7a6455 cp_parser_binary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8798
0x7a6d40 cp_parser_assignment_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9086
0x7a717a cp_parser_constant_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9354
0x7a7904 cp_parser_initializer_clause
        ../../gcc-source-trunk/gcc/cp/parser.c:21048
0x7a929b cp_parser_initializer
        ../../gcc-source-trunk/gcc/cp/parser.c:20986
0x7bb3fc cp_parser_init_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:18851
0x7bbb39 cp_parser_simple_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12567
0x7bbe71 cp_parser_block_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12435
0x7c3dd0 cp_parser_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12332
0x7c2914 cp_parser_declaration_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:12211
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$


-------------------------------------------------------------------------


template < typename S > struct A
{ 
  template < typename T > static auto f () { return 0; }
  template < class U = decltype (f < S > ()) > int g () { return 0; }
};

auto a = A < int > {}.g ();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]