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

            Bug ID: 60992
           Summary: [4.9/4.10 Regression] ICE in tsubst_copy, at
                    cp/pt.c:12637
           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

Google ref: b/14350545

Test:

/// --- cut ---
struct ScopeGuardGenerator { };

struct FF
{
  template < class F, class ... Ts >
  void
  operator () (F & ...)
  {
    const int n = sizeof ... (Ts);
    void *mutexes[n];
    auto _on_scope_exit_var_0 =
      ScopeGuardGenerator () + [&mutexes] { };
  }
};

template < class F >
int operator+ (ScopeGuardGenerator, F) { return 1; }

struct D
{
  template < class T0, class T1, class T2, class ... T >
  void
  operator () (T0, T1, const T2 & t2, T & ... t)
  {
    base (t2, t ...);
  }
  FF base;
};

D run_with_locks;

void Fn ()
{
  run_with_locks ([] { }, 0, 0);
}
/// ---cut---


Using current trunk (r209848):

g++ -c -std=c++11 t2.ii
t2.ii: In instantiation of ‘FF::operator()(F&, ...)::<lambda()> [with F = const
int; Ts = {}]’:
t2.ii:12:34:   required from ‘struct FF::operator()(F&, ...) [with F = const
int; Ts = {}]::<lambda()>’
t2.ii:12:30:   required from ‘void FF::operator()(F&, ...) [with F = const int;
Ts = {}]’
t2.ii:25:5:   required from ‘void D::operator()(T0, T1, const T2&, T& ...)
[with T0 = Fn()::<lambda()>; T1 = int; T2 = int; T = {}]’
t2.ii:34:31:   required from here
t2.ii:12:43: internal compiler error: in tsubst_copy, at cp/pt.c:12637
       ScopeGuardGenerator () + [&mutexes] { };
                                           ^
0x5d35cd tsubst_copy
    ../../gcc/cp/pt.c:12637
0x5af80b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:15150
0x5ba6f6 tsubst_expr
    ../../gcc/cp/pt.c:13979
0x5c4097 tsubst(tree_node*, tree_node*, int, tree_node*)
    ../../gcc/cp/pt.c:11596
0x5c33f5 tsubst(tree_node*, tree_node*, int, tree_node*)
    ../../gcc/cp/pt.c:12045
0x5c2c4b tsubst(tree_node*, tree_node*, int, tree_node*)
    ../../gcc/cp/pt.c:11561
0x5d55a0 tsubst_decl
    ../../gcc/cp/pt.c:11043
0x5c388f tsubst(tree_node*, tree_node*, int, tree_node*)
    ../../gcc/cp/pt.c:11492
0x5bb12c tsubst_expr
    ../../gcc/cp/pt.c:13438
0x5bb249 tsubst_expr
    ../../gcc/cp/pt.c:13586
0x5b8399 instantiate_decl(tree_node*, int, bool)
    ../../gcc/cp/pt.c:19875
0x5f4147 instantiate_class_template_1
    ../../gcc/cp/pt.c:9334
0x5f4147 instantiate_class_template(tree_node*)
    ../../gcc/cp/pt.c:9402
0x6879f3 complete_type(tree_node*)
    ../../gcc/cp/typeck.c:134
0x5afa30 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:15247
0x5b19bb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:14362
0x5ba6f6 tsubst_expr
    ../../gcc/cp/pt.c:13979
0x5bd579 tsubst_expr
    ../../gcc/cp/pt.c:13489
0x5ba0a3 tsubst_expr
    ../../gcc/cp/pt.c:13381
0x5bb249 tsubst_expr
    ../../gcc/cp/pt.c:13586
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.


The test compiles cleanly with Clang and gcc-4.8 (at least the version I have).

Reply via email to