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++/71832] New: ICE on invalid C++11 code with incorrect decltype use for non-type template parameter: Segmentation fault


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

            Bug ID: 71832
           Summary: ICE on invalid C++11 code with incorrect decltype use
                    for non-type template parameter: Segmentation fault
           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: ---

The following C++11 code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.  

This is a regression from 6.1.x. 


$ 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 20160710 (experimental) [trunk revision 238196] (GCC)
$
$ g++-6.1 -c small.cpp
small.cpp:2:21: error: expected nested-name-specifier before ‘decltype’
 template < typename decltype (0) > struct A
                     ^~~~~~~~
small.cpp:2:21: error: two or more data types in declaration of ‘parameter’
$
$ g++-trunk -c small.cpp
small.cpp:2:21: error: expected nested-name-specifier before ‘decltype’
 template < typename decltype (0) > struct A
                     ^~~~~~~~
small.cpp:2:21: error: two or more data types in declaration of ‘parameter’
small.cpp: In substitution of ‘template<<declaration error> > template<class
... S> void A<<declaration error> >::baz() [with S = <missing>; <declaration
error> = {}]’:
small.cpp:4:22:   required from here
small.cpp:4:22: internal compiler error: Segmentation fault
   void foo () { baz (); }
                      ^
0xdbae6f crash_signal
        ../../gcc-source-trunk/gcc/toplev.c:335
0x73d863 tree_class_check
        ../../gcc-source-trunk/gcc/tree.h:3152
0x73d863 pop_nested_class()
        ../../gcc-source-trunk/gcc/cp/class.c:7785
0x702980 instantiate_template_1
        ../../gcc-source-trunk/gcc/cp/pt.c:17485
0x702980 instantiate_template(tree_node*, tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/pt.c:17534
0x71439c 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:17909
0x6746fb add_template_candidate_real
        ../../gcc-source-trunk/gcc/cp/call.c:3113
0x67542c add_template_candidate
        ../../gcc-source-trunk/gcc/cp/call.c:3191
0x67542c add_candidates
        ../../gcc-source-trunk/gcc/cp/call.c:5363
0x675cc6 build_new_method_call_1
        ../../gcc-source-trunk/gcc/cp/call.c:8391
0x675cc6 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:8590
0x791ef3 cp_parser_postfix_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:6880
0x79a68c cp_parser_unary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:7991
0x79aee7 cp_parser_cast_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8668
0x79b4e5 cp_parser_binary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8770
0x79bdd0 cp_parser_assignment_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9058
0x79e6c9 cp_parser_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9225
0x79ee3f cp_parser_expression_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10686
0x78cc7b cp_parser_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10537
0x78d93c cp_parser_statement_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:10809
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.
$


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


// should be: template < decltype (0) > struct A
template < typename decltype (0) > struct A
{ 
  void foo () { baz (); }
  template < typename ... S > void baz () {};
};

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