Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-27514

clangd fixit on Windows defaults to a bad choice in Qt Creator 7.01

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt Creator 8.0.0-beta1
    • Qt Creator 7.0.1
    • None
    • Windows 10 Home 21H1 19043.1645

      Qt Creator 7.01

      MS Visual C++ compiler version 15
    • macOS, Windows

    Description

      I see this with "2712:5: Using the result of an assignment as a condition without parentheses (fixes available)" but the behavior I'm reporting probably happens with other warnings.

      This warning is triggered by code like this:

      	if(flg=pP->getFlag(scaleFlags)){
      

      The warning puts a little yellow triangle in the left margin, and a light bulb at the end of the line that invokes fixits:

      Prior to 7.01 clicking on the lightbulb presented a popup with two fixit choices: either replace "=" with "==" or to enclose the assignment in parens to show that the assignment is intentional. In 7.01 if I click the lightbulb, it simply applies the conversion to "==". I did this recently and didn't notice the problem, creating a bug that was very hard to see!

      Further, hoviering over the yellow triangle puts up a tooltip-like window with info about the warning:

      The blue text is a link, clicking the link applies BOTH fixits:

      	if((flg==pP->getFlag(scaleFlags))){
      

      Now I have two clangd warnings!

      Our application is very old and has a ton of these. I use the fixit to enclose in parens every day!

      Attachments

        Activity

          People

            davschul David Schulz
            johnweeks John Weeks
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: