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

std::string::replace (iterator, iterator, InputIterator, InputIterator) inserting self incorrect

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.1.3, 4.1.4, 4.2.0
    • Fix Version/s: 4.3.0
    • Component/s: 21. Strings
    • Labels:
      None
    • Environment:

      all

      Description

      This test fails:

      #include <iostream>
      #include <string>

      static const char* test = "babc";

      int main (void)
      {
      std::string s ("abc");
      s.replace (s.begin (), s.begin (), s.begin () + 1, s.begin () + 2);

      std::cout << "Expected " << test << " and got " << s << '\n';

      return 0;
      }

      The output is "Expected babc and got aabc".

      See details here:
      http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200604.mbox/%3c44337C76.4020909@roguewave.com%3e

        Attachments

        1. string.cc.diff
          9 kB
          Farid Zaripov
        2. stdcxx-170.patch
          2 kB
          Travis Vitek
        3. 21.string.replace.stdcxx-170.cpp
          2 kB
          Farid Zaripov

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pevtsov Anton Pevtsov
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

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