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

QString::arg(char16_t{}) prefers the integral, not the QChar overload

XMLWordPrintable

    • 8
    • a6d2e45d5 (dev), 86e180ec4 (6.7), db8901c04 (tqtc/lts-6.5), a6f01f12c (tqtc/lts-6.2), 4bb36a6e7 (dev), 3750611d6 (6.7), 3c0bd5c36 (tqtc/lts-6.5), 563ed822f (dev)
    • Foundation Sprint 108, Foundation Sprint 109, Foundation Sprint 110, Foundation Sprint 111, Foundation Sprint 112, Foundation Sprint 113, Foundation Sprint 114, Foundation Sprint 115, Foundation Sprint 116, Foundation Sprint 117, Foundation Sprint 118, Foundation Sprint 119, Foundation Sprint 120, Foundation Sprint 121

      QString fmt = "%1";
      assert(fmt.arg(u' ') == " "); // FAIL: result is "32"
      

      Problem here is that we have a large historic body of code which may rely on this. Maybe we need to = delete the overload?

      The QLatin1StringView and QStringView overloads use the multi-arg code path for this, and treat char16_t as a character.

      This also means that the behaviour differs between QString::arg() and QString::multiArg().

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

            mmutz Marc Mutz
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: