public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16209] New: Internal Compiler Error (ICE) Inheriting from std::vector
@ 2004-06-25 20:38 kmahler at ausafs dot ihost dot com
  2004-06-25 20:38 ` [Bug c++/16209] " bangerth at dealii dot org
  2004-06-30 15:34 ` kmahler at ausafs dot ihost dot com
  0 siblings, 2 replies; 3+ messages in thread
From: kmahler at ausafs dot ihost dot com @ 2004-06-25 20:38 UTC (permalink / raw)
  To: gcc-bugs

I get an ICE with the following code:

// main_7.cc

#include <vector>

class A {
public:
  A(int input_a) : this_a(input_a) {}
  int this_a;
};

class B : public std::vector<A*> {};

int main(int argc, char* argv[]) {

  A my_A_1(1);
  A my_A_2(2);

  B my_B;

  my_B.push_back(&my_A_1);

  my_B.push_back(&my_A_2);

  A* my_A_ptr = my_B.std::vector::at(1);

  // main_7.cc: In function `int main(int, char **)':
  // main_7.cc:41: no matching function for call to `B::at (int)'
  // A* my_A_ptr = my_B.at(1);

  return(0);
}

***** end of file *****

If I replace "std::vector" with my own simple version, no ICE results:

// main_10.cc

//#include <vector>

template <class TYPE>
class table {
public:
  table() { next_index = 0; }
  void push_back(TYPE my_type) { array[next_index] = my_type; next_index++; }
  int size(void) { return(next_index); }
  TYPE& at(int specified_index) { return( array[specified_index] ); }
  TYPE array[10];
  int next_index;
};

class A {
public:
  A(int input_a) : this_a(input_a) {}
  int this_a;
};

class B : public table<A*> {};

int main(int argc, char* argv[]) {

  A my_A_1(1);
  A my_A_2(2);

  B my_B;

  my_B.push_back(&my_A_1);

  my_B.push_back(&my_A_2);

  A* my_A_ptr = my_B.at(1);

  return(0);
}

***** end of file *****

Also, in the first file, "main_7.cc", why does "A* my_A_ptr = my_B.at(1);" get 
a compile error and "A* my_A_ptr = my_B.std::vector::at(1);" does not.  

Yet, in the second file, "main_10.cc", "A* my_A_ptr = my_B.at(1);" compiles.

OS: SunOS 5.8
KernalID=Generic_108528-23

-- 
           Summary: Internal Compiler Error (ICE) Inheriting from
                    std::vector
           Product: gcc
           Version: 2.95.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kmahler at ausafs dot ihost dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-06-30 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-25 20:38 [Bug c++/16209] New: Internal Compiler Error (ICE) Inheriting from std::vector kmahler at ausafs dot ihost dot com
2004-06-25 20:38 ` [Bug c++/16209] " bangerth at dealii dot org
2004-06-30 15:34 ` kmahler at ausafs dot ihost dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).