fix: resolve QStringBuilder type mismatch in ternary operator#4311
Open
SD191100 wants to merge 1 commit into
Open
fix: resolve QStringBuilder type mismatch in ternary operator#4311SD191100 wants to merge 1 commit into
SD191100 wants to merge 1 commit into
Conversation
|
Member
|
The change itself seems trivial, I'll include it for 1.0.8. The main question remainig is, why enforce QT_USE_QSTRINGBUILDER ? Is there any issue without it, did you run any measurements? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes a compilation failure occurring under explicit compilation configurations where
QT_USE_QSTRINGBUILDERis enforced.Problem
At line 837 in
src/utils/folderutils.cpp, a ternary conditional operator (? :) evaluates an empty string literal(const char*)on the left branch, and a concatenatedQStringexpression on the right branch. UnderQT_USE_QSTRINGBUILDERoptimizations, the right-hand expression evaluates as a lazyQStringBuildertemplate type. Because C++ strict type resolution requires uniform type yields across both conditional evaluation paths, the compiler throws a fatal initialization error due to type mismatch.The Solution
Explicitly returned an optimized, default-constructed
QString("")on the true branch evaluation block to satisfy type parity across compiler configurations.note: This is my very first Pull Request to an open-source project. If there are any project-specific formatting preferences, commit linting styles, or documentation guidelines I missed, please let me know