Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
6.9
-
72becc7c1 (dev), 78f9131ef (6.9)
-
framework-content 10, framework-content 11
Description
https://doc.qt.io/qt-6/qlatin1stringview.html#details has a snippet that uses _L1:
if (str == "auto"_L1 || str == "extern"_L1 || str == "static"_L1 || str == "register"_L1 { ... }
This code won't compile unless the user has made those literals available:
/home/mitch/dev/temp/quick2/main.cpp:29:20: error: unable to find string literal operator ‘operator""_L1’ with ‘const char [5]’, ‘long unsigned int’ arguments 29 | const auto t = "test"_L1; | ^~~~~~~~~
The error gives the user no help, so the only solution is to document the namespace whenever these literals are used:
using namespace Qt::Literals::StringLiterals;
Attachments
For Gerrit Dashboard: QTBUG-135945 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
645248,5 | Doc: QLatin1StringView documentation misses string literals namespace | dev | qt/qtbase | Status: MERGED | +2 | 0 |
645602,2 | Doc: QLatin1StringView documentation misses string literals namespace | 6.9 | qt/qtbase | Status: MERGED | +2 | 0 |
645893,2 | Doc: QLatin1StringView documentation misses string literals namespace | tqtc/lts-6.8 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |