| Summary: | Not possible to use Q_GLOBAL_STATIC with QStringLiteral. | ||
|---|---|---|---|
| Product: | [Developer tools] clazy | Reporter: | Roman <dismine> |
| Component: | general | Assignee: | Unassigned bugs <unassigned-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | smartins |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://commits.kde.org/clazy/8404219d174ffb4aaf7a713704db0abf93ffa47a | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
Git commit 8404219d174ffb4aaf7a713704db0abf93ffa47a by Sergio Martins. Committed on 13/03/2018 at 12:21. Pushed by smartins into branch '1.3'. Don't recommend QStringLiteral in Q_GLOBAL_STATIC_WITH_ARGS Doesn't compile since it got noexcept M +7 -0 src/checks/level2/qstring-allocations.cpp M +4 -0 tests/qstring-allocations/main.cpp M +4 -0 tests/qstring-allocations/main.cpp_fixed.cpp.expected https://commits.kde.org/clazy/8404219d174ffb4aaf7a713704db0abf93ffa47a |
Looks like it is impossible to use Q_GLOBAL_STATIC with QStringLiteral. Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUnit, (QStringLiteral("unit"))) It just won't compile. I get error "lambda expression in an unevaluated operand". But if i switch to Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUnit, (QLatin1String("unit"))) i get warning "qstring-allocations" from clazy.