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

            Bug ID: 80043
           Summary: [6/7 Regression] ICE with pointer-to-member-function
                    and -fpermissive
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following code snippet (compiled with -fpermissive) triggers an ICE
since GCC 6.1.0:

=================================
struct A
{
  template<int> void foo()
  {
    void (A::* fp)();
    fp = A::foo<0>;
  }
};

void bar()
{
  A().foo<0>();
}
=================================

bug.cc: In instantiation of 'void A::foo() [with int <anonymous> = 0]':
bug.cc:12:14:   required from here
bug.cc:6:8: warning: assuming pointer to member 'void A::foo() [with int
<anonymous> = 0]' [-fpermissive]
     fp = A::foo<0>;
     ~~~^~~
bug.cc:6:8: note: (a pointer to member can only be formed with '&A::foo<0>')
bug.cc:6:5: internal compiler error: in finish_expr_stmt, at cp/semantics.c:677
     fp = A::foo<0>;
     ^~
0x7affd0 finish_expr_stmt(tree_node*)
        ../../gcc-6.1.0/gcc/cp/semantics.c:677
0x683322 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-6.1.0/gcc/cp/pt.c:15121
0x68089c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-6.1.0/gcc/cp/pt.c:15103
0x681662 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-6.1.0/gcc/cp/pt.c:15289
0x6c105e instantiate_decl(tree_node*, int, bool)
        ../../gcc-6.1.0/gcc/cp/pt.c:22013
0x6c7e3b instantiate_pending_templates(int)
        ../../gcc-6.1.0/gcc/cp/pt.c:22130
0x708d61 c_parse_final_cleanups()
        ../../gcc-6.1.0/gcc/cp/decl2.c:4599
Please submit a full bug report, [etc.]

Reply via email to