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

stream iterators into different streams compare equal

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.3, 4.2.0
    • Fix Version/s: 4.2.1
    • Component/s: 24. Iterators
    • Labels:
      None
    • Severity:
      Incorrect Behavior

      Description

      As Travis says in his reply to my post here:
      http://www.nabble.com/stream-iterators-into-different-streams-compare-equal--tf4721505.html#a13498487:

      Given 24.5.1.1 p1 and p2, it is pretty clear to me that the two iterators are both non-end-of-stream type, and they are both created on different streams. The streams are different, so the iterators should not compare equal. I guess one could claim that 24.5.1.2 p6 conflicts with 24.5 p3 because 'end-of-stream' isn't clearly defined, but in this particular case that doesn't matter.

      This program aborts with stdcxx but not with gcc:

      #include <assert.h>
      #include <iterator>
      #include <sstream>
      
      int main ()
      {
          std::istringstream a ("1");
          std::istream_iterator<int> i (a);
      
          std::istringstream b ("2");
          std::istream_iterator<int> j (b);
      
          assert (!(i == j));
      } 
      

        Attachments

        1. c++std-lib-20221.eml
          5 kB
          Martin Sebor

          Issue Links

            Activity

              People

              • Assignee:
                sebor Martin Sebor
                Reporter:
                mbrown Mark Brown
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 2h Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 8h
                  8h