This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: internal compiler error 364


On Fri, 10 Apr 1998, I Lee Hetherington wrote:
> The following short program causes internal compiler error 364:
> 
>      #include <vector>
> 
>      int main()
>      {
>          int i = 1;
>          vector<int&> v;
>          v.push_back(i);
>      }

The current CVS snapshot does not ``die'' any more, but complains

  x.cc:6: cannot form type pointer to reference type int & during template
  instantiation
  /sw/swtest/egcs/include/g++/stl_vector.h:69: cannot form type pointer to
  reference type int & during template instantiation
  /sw/swtest/egcs/include/g++/stl_alloc.h:225: cannot form type pointer to
  reference type int & during template instantiation
  /sw/swtest/egcs/include/g++/stl_vector.h:144: cannot form type reference
  to reference type int &const during template instantiation
  :

> (I'm not sure it is kosher to put references in an STL vector, but it
> does crash the compiler.)  Here is the compiler output:

I believe it's not kosher. If I remember correctly, STL does make use of
operator=, which would cause extremly strange results for references!

(Recall that assignment of references has quite different semantics than
that of other data types.)

Gerald
-- 
Gerald Pfeifer (Jerry)      Vienna University of Technology
pfeifer@dbai.tuwien.ac.at   http://www.dbai.tuwien.ac.at/~pfeifer/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]