Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99291

As a user of QStringBuilder, I would like the system to pin down rvalues, like QStringTokenizer does

    XMLWordPrintable

    Details

    • Type: User Story
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      In our projects, we use the AAA (almost-always auto) style, which gives us trouble when we enable QStringBuilder:

      // without QStringBuilder:
      auto s2 = s + QString::fromLatin1("foo"); // ok, s2 is a QString
      label.setText(s2);
      // with QStringBuilder
      auto s2 = s + QString::fromLatin1("foo"); // oops, s2 is a QStringBuilder<QString, QString>
      // temporary returned fromLatin1() destroyed now
      label.setText(s2); // conversion to actual QString here, accesses deleted data
      

      I like how QStringTokenizer doesn't have this problem, and I think the same technique used there can also be used in QStringBuilder.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            cnn Qt Core & Network
            Reporter:
            mmutz Marc Mutz
            PM Owner:
            Vladimir Minenko Vladimir Minenko
            RnD Owner:
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes