Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-611

vector container does not work with types that implement unary operator&

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.2.0
    • 4.2.1
    • 23. Containers
    • None
    • All

    • Patch Available
    • Incorrect Behavior

    Description

      This could result in failure to compile or unexpected runtime behavior. Discussion on this issue can be found here http://tinyurl.com/2t7vjp

      #include <vector> // for vector

      struct S
      {
      void operator& () const {};
      };

      int main ()
      {
      const S s [3];

      // this is just a compile test, it is not intended to run

      std::vector<S> v;
      v.assign (1, s [0]);
      v.assign (s, s+3);
      v.at (0);
      v.back ();
      v.begin ();
      v.capacity ();
      v.empty ();
      v.end ();
      v.front ();
      v.insert (v.begin (), s [0]);
      v.insert (v.begin (), s, s+3);
      v.insert (v.begin (), 2, s [0]);
      v.erase (v.begin ());
      v.erase (v.begin (), v.end ());
      v.max_size ();
      v.pop_back ();
      v.push_back (s[0]);
      v.rbegin ();
      v.rend ();
      v.reserve (10);
      v.resize (10);
      v.size ();
      std::vector<S>().swap (v);

      return 0;
      }

      Attachments

        1. 23.vector.stdcxx-611.cpp
          2 kB
          Farid Zaripov

        Activity

          People

            farid Farid Zaripov
            vitek Travis Vitek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: