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

            Bug ID: 77508
           Summary: ICE on valid C++ code: in
                    finish_class_member_access_expr, at cp/typeck.c:2783
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

This is a regression from 6.2. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160906 (experimental) [trunk revision 240004] (GCC)
$
$ g++-6.2 small.cpp
$ clang++ small.cpp
$
$ g++-trunk small.cpp
small.cpp: In member function ‘void B<T>::g()’:
small.cpp:10:23: internal compiler error: in finish_class_member_access_expr,
at cp/typeck.c:2783
     this->B::template f < &B < T >::g > ();
                       ^~~~~~~~~~~~~~~~~
0x7e8254 finish_class_member_access_expr(cp_expr, tree_node*, bool, int)
        ../../gcc-source-trunk/gcc/cp/typeck.c:2783
0x79dd04 cp_parser_postfix_dot_deref_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:7364
0x79b54c cp_parser_postfix_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:6967
0x799e6c cp_parser_unary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8019
0x7a3d17 cp_parser_cast_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8696
0x7a4315 cp_parser_binary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8798
0x7a4c00 cp_parser_assignment_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9086
0x7a74f9 cp_parser_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9253
0x7a7b1f cp_parser_expression_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10736
0x7b645c cp_parser_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10587
0x7b73dc cp_parser_statement_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:10859
0x7b74cf cp_parser_compound_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10813
0x7b767f cp_parser_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:20832
0x7b767f cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:20868
0x7b8121 cp_parser_function_definition_after_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:25565
0x7bbf80 cp_parser_late_parsing_for_member
        ../../gcc-source-trunk/gcc/cp/parser.c:26446
0x796d56 cp_parser_class_specifier_1
        ../../gcc-source-trunk/gcc/cp/parser.c:21719
0x798679 cp_parser_class_specifier
        ../../gcc-source-trunk/gcc/cp/parser.c:21745
0x798679 cp_parser_type_specifier
        ../../gcc-source-trunk/gcc/cp/parser.c:15971
0x7abdf3 cp_parser_decl_specifier_seq
        ../../gcc-source-trunk/gcc/cp/parser.c:12889
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.
$


-------------------------------------------------------


template < typename T > struct A
{ 
  template < void (T::*Fn) () > void f () {}
};

template < typename T > struct B : A < B < T > >
{ 
  void g ()
  { 
    this->B::template f < &B < T >::g > ();
  }
};

int main ()
{ 
  B < int > b;
  b.g ();
  return 0;
}

Reply via email to