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

            Bug ID: 67845
           Summary: ICE on invalid use of const qualifier on
                    x86_64-linux-gnu
           Product: gcc
           Version: 6.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 code causes an ICE when compiled with the current gcc trunk on
x86_64-linux-gnu.  

This is a regression from 5.2.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/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20151004 (experimental) [trunk revision 228457] (GCC) 
$ 
$ g++-5.2 -c small.cc
small.cc:3:3: error: non-member function ‘void foo()’ cannot have cv-qualifier
 F foo;
   ^
small.cc:4: confused by earlier errors, bailing out
$ 
$ 
$ g++-trunk -c small.cc
small.cc:3:3: error: non-member function ‘void foo()’ cannot have cv-qualifier
 F foo;
   ^
small.cc:4:11: internal compiler error: in merge_types, at cp/typeck.c:854
 void foo ();
           ^
0x71e224 merge_types(tree_node*, tree_node*)
        ../../gcc-trunk/gcc/cp/typeck.c:854
0x5f8f72 duplicate_decls(tree_node*, tree_node*, bool)
        ../../gcc-trunk/gcc/cp/decl.c:2029
0x7bd77e pushdecl_maybe_friend_1
        ../../gcc-trunk/gcc/cp/name-lookup.c:812
0x7bd77e pushdecl_maybe_friend(tree_node*, bool)
        ../../gcc-trunk/gcc/cp/name-lookup.c:1305
0x6134e3 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc-trunk/gcc/cp/decl.c:4913
0x7016b2 cp_parser_init_declarator
        ../../gcc-trunk/gcc/cp/parser.c:18042
0x702282 cp_parser_simple_declaration
        ../../gcc-trunk/gcc/cp/parser.c:11956
0x6fda24 cp_parser_block_declaration
        ../../gcc-trunk/gcc/cp/parser.c:11837
0x70bfd7 cp_parser_declaration
        ../../gcc-trunk/gcc/cp/parser.c:11734
0x70a53a cp_parser_declaration_seq_opt
        ../../gcc-trunk/gcc/cp/parser.c:11613
0x70a880 cp_parser_translation_unit
        ../../gcc-trunk/gcc/cp/parser.c:4169
0x70a880 c_parse_file()
        ../../gcc-trunk/gcc/cp/parser.c:34599
0x857542 c_common_parse_file()
        ../../gcc-trunk/gcc/c-family/c-opts.c:1064
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.
$ 


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


typedef void F () const;

F foo;
void foo ();

Reply via email to