Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
Qt Creator 4.15.2
Description
In my code, I have an initializer that takes the following form...
Foo::Foo(QString possiblyEmpty) : someQStringMember{possiblyEmpty.isEmpty() ? "replacement" : possiblyEmpty}, anotherMember{"Ĉu vi komprenas ĉi tiun frazon? ;)"} { // life carries on... }
...the idea being that someQStringMember should never be empty, even if
{possiblyEmpty}is empty. The problem with this is that Qt Creator doesn't correctly parse this, thinks that anotherMember{"something nice"} is part of the initializer list for possiblyEmpty, and breaks formatting for the entire constructor body.
This issue can be worked around by wrapping the ternary operation in parentheses, but it would be nice to have a proper fix.
Attachments
Issue Links
- duplicates
-
QTCREATORBUG-15537 Shorthand-if inside an initializer list is being misinterpreted when using uniform initialization syntax
- Closed