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

            Bug ID: 61445
           Summary: [C++11][4.10 Regression] ice in instantiate_decl
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

This appears to be a recent regression in trunk.
Source reduced from llvm/tools/clang/tools/clang-check/ClangCheck.cpp

Using trunk @r211286:

gcc-svn-r211286/bin/g++ -c t1.ii -std=c++11
t1.ii: In instantiation of ‘void newFrontendActionFactory(FactoryT*,
int*)::A::m_fn1() [with FactoryT = int]’:
t1.ii:18:5:   required from ‘void newFrontendActionFactory(FactoryT*, int*)
[with FactoryT = int]’
t1.ii:19:33:   required from here
t1.ii:11:13: internal compiler error: in instantiate_decl, at cp/pt.c:19753
             B (0, 0);
             ^
0x5c6d0f instantiate_decl(tree_node*, int, bool)
    ../../gcc/cp/pt.c:19752
0x63cda3 mark_used(tree_node*, int)
    ../../gcc/cp/decl2.c:5016
0x557f73 build_over_call
    ../../gcc/cp/call.c:7335
0x563880 build_new_method_call_1
    ../../gcc/cp/call.c:8047
0x563880 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
    ../../gcc/cp/call.c:8117
0x564959 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
    ../../gcc/cp/call.c:7661
0x607df6 build_functional_cast(tree_node*, tree_node*, int)
    ../../gcc/cp/typeck2.c:1935
0x5bbf86 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:14415
0x5ca963 tsubst_expr
    ../../gcc/cp/pt.c:14133
0x5cad61 tsubst_expr
    ../../gcc/cp/pt.c:13559
0x5caf03 tsubst_expr
    ../../gcc/cp/pt.c:13731
0x5c8503 instantiate_decl(tree_node*, int, bool)
    ../../gcc/cp/pt.c:20043
0x5caa2b tsubst_expr
    ../../gcc/cp/pt.c:13872
0x5ca273 tsubst_expr
    ../../gcc/cp/pt.c:13545
0x5caf03 tsubst_expr
    ../../gcc/cp/pt.c:13731
0x5c8503 instantiate_decl(tree_node*, int, bool)
    ../../gcc/cp/pt.c:20043
0x601387 instantiate_pending_templates(int)
    ../../gcc/cp/pt.c:20159
0x63e7ef cp_write_global_declarations()
    ../../gcc/cp/decl2.c:4348
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.

The crash does not reproduce without -std=c++11, nor using trunk build
@r210629.

/// -- cut ---
template < typename FactoryT > void newFrontendActionFactory (FactoryT *, int *
= 0);
int a;

template < typename FactoryT >
void newFrontendActionFactory (FactoryT *, int *)
{
    class A
    {
        void m_fn1 ()
        {
            B (0, 0);
        }
        class B
        {
        public:
            B (FactoryT, int);
        };
    };
    newFrontendActionFactory (&a);
}

Reply via email to