g++ asked me to submit this report. It crashed on the following piece of code:

template < typename eval >
struct tpl_seq_search {

  typedef typename eval::enum_type  Enum;

  template < Enum first, Enum last >
  struct range {

    static void find () {
      range<first+1,last>::find();
    }

  };// range

  template < Enum val >
  struct range<val,val> {

    static void find () {}

  };// range

}; // tpl_bin_search

template < typename eval, typename eval::enum_type first, typename
eval::enum_type last >
void
tpl_seq_search_from_to () {
  return( tpl_seq_search<eval>::template range<first,last>::find() );
}

struct xxx {

  typedef int enum_type;
  static enum_type const first = 0;
  static enum_type const last = 20;

};

int main ( void ) {
  tpl_seq_search_from_to<xxx,xxx::first,xxx::last>();
}

gcc> /added/pkg/gcc-4.0.2/usr/bin/g++ bug_20051208_01.cc 
bug_20051208_01.cc: In function 'void tpl_seq_search_from_to() [with eval =
xxx, typename eval::enum_type first = 0, typename eval::enum_type last = 20]':
bug_20051208_01.cc:39:   instantiated from here
bug_20051208_01.cc:27: internal compiler error: in lookup_member, at
cp/search.c:1209
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.



The specs are:

gcc> /added/pkg/gcc-4.0.2/usr/bin/g++ -v                 
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.2/configure --prefix=/added/pkg/gcc-4.0.2/usr
Thread model: posix
gcc version 4.0.2


Best

Kai-Uwe Bux


-- 
           Summary:  internal compiler error: in lookup_member, at
                    cp/search.c:1209
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jkherciueh at gmx dot net


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

Reply via email to