Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.9
-
framework-content 10
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;