http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56014



             Bug #: 56014

           Summary: [C++1y] Return type deduction for member functions

                    does not work when -g is enabled

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: jogoja...@gmail.com





Created attachment 29187

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29187

Preprocessed file



GCC version: Snapshot 4.8-20130113 (built from source)

System: Linux diogenes 3.6.11-1.fc17.x86_64



C++1y implements return type deduction for functions (i.e. without trailing

return type). This does not work when the following two conditions are

satisfied:



 - The function is a member function (static or non-static)

 - *and* the -g option is used



Example:



#include <iostream>



struct Elem

{

  static auto test()

  { return 12; }

};



int main()

{

  std::cout << Elem::test() << std::endl;

  return 0;

}



When compiling this code using `g++ --std=c++1y -g -o test ./test.cpp`, the

following error is displayed:



./test.cpp:3:8: internal compiler error: in gen_type_die_with_usage, at

dwarf2out.c:19477

 struct Elem

        ^

0x813d06 gen_type_die_with_usage

        ../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19477

0x810c25 gen_decl_die

        ../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19971

0x812afc gen_member_die

        ../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19037

0x812afc gen_struct_or_union_type_die

        ../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19110

0x812afc gen_tagged_type_die

        ../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19300

0x813ced gen_type_die_with_usage

        ../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19447

0x810e6a gen_decl_die

        ../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:20010

0x9deed2 rest_of_type_compilation(tree_node*, int)

        ../../gdc/gcc-4.8-20130106/gcc/passes.c:217

0x5c7c0d finish_struct_1(tree_node*)

        ../../gdc/gcc-4.8-20130106/gcc/cp/class.c:6390

0x5c90cc finish_struct(tree_node*, tree_node*)

        ../../gdc/gcc-4.8-20130106/gcc/cp/class.c:6555

0x5f71be cp_parser_class_specifier_1

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:18245

0x5f71be cp_parser_class_specifier

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:18453

0x5f71be cp_parser_type_specifier

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:13568

0x60e2cd cp_parser_decl_specifier_seq

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10895

0x611ce9 cp_parser_simple_declaration

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10494

0x613c60 cp_parser_block_declaration

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10443

0x61c84b cp_parser_declaration

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10340

0x61b51d cp_parser_declaration_seq_opt

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10226

0x61cdc2 cp_parser_translation_unit

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:3808

0x61cdc2 c_parse_file()

        ../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:28175

Please submit a full bug report,





The error also occurs when the function is non-static. It does *not* occur,

however, when '-g' isn't used, or when the function is not a member function.

Reply via email to