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



             Bug #: 57092

           Summary: Using decltype of function pointer type to define a

                    data member causes compiler crash

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

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

        ReportedBy: kjw.c...@gmail.com





This code:



    template <void (*F)(int)>

    class B {

        decltype(F) v;

    };



    void foo(int) {}



    int main() {

        B<foo> o;

    }



causes this crash:



    $ g++ -std=c++11 bug.cpp

    bug.cpp: In instantiation of 'class B<foo>':

    bug.cpp:9:12:   required from here

    bug.cpp:3:17: internal compiler error: in finish_decltype_type, at

cp/semantics.c:5365

         decltype(F) v;

                     ^

    0x5a6230 finish_decltype_type(tree_node*, bool, int)

            ../../src/gcc/cp/semantics.c:5365

    0x521c5c tsubst(tree_node*, tree_node*, int, tree_node*)

            ../../src/gcc/cp/pt.c:11772

    0x51fe2e tsubst_decl

            ../../src/gcc/cp/pt.c:10450

    0x5218a7 tsubst(tree_node*, tree_node*, int, tree_node*)

            ../../src/gcc/cp/pt.c:11081

    0x52f177 instantiate_class_template_1

            ../../src/gcc/cp/pt.c:8818

    0x52f177 instantiate_class_template(tree_node*)

            ../../src/gcc/cp/pt.c:9054

    0x57ce2d complete_type(tree_node*)

            ../../src/gcc/cp/typeck.c:131

    0x4ff471 start_decl_1(tree_node*, bool)

            ../../src/gcc/cp/decl.c:4662

    0x50d294 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,

tree_node*, tree_node*, tree_node**)

            ../../src/gcc/cp/decl.c:4625

    0x572b98 cp_parser_init_declarator

            ../../src/gcc/cp/parser.c:15914

    0x5734ce cp_parser_simple_declaration

            ../../src/gcc/cp/parser.c:10567

    0x56edd0 cp_parser_block_declaration

            ../../src/gcc/cp/parser.c:10448

    0x56fdf0 cp_parser_declaration_statement

            ../../src/gcc/cp/parser.c:10092

    0x570497 cp_parser_statement

            ../../src/gcc/cp/parser.c:8867

    0x57167e cp_parser_statement_seq_opt

            ../../src/gcc/cp/parser.c:9139

    0x57179e cp_parser_compound_statement

            ../../src/gcc/cp/parser.c:9093

    0x5718e8 cp_parser_function_body

            ../../src/gcc/cp/parser.c:17680

    0x5718e8 cp_parser_ctor_initializer_opt_and_function_body

            ../../src/gcc/cp/parser.c:17716

    0x57252f cp_parser_function_definition_after_declarator

            ../../src/gcc/cp/parser.c:21691

    0x573143 cp_parser_function_definition_from_specifiers_and_declarator

            ../../src/gcc/cp/parser.c:21612

    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.

Reply via email to