Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-72222

Featuretest Macros lead to Error with Intellisense

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.11.2, 5.12.0 RC2
    • Core: Other
    • None
    • VisualStudio.15.Release/15.9.3+28307.145, Windows 10 Pro, msvc2017_64
    • Windows

    Description

      With Visual Studio Version 15.9.3+28307.145, the simple test programs (see below) result in the following IntelliSense errors in the feature test macros:

      Error (active) E2512 the argument to a feature-test macro must be a simple identifier QtGuiApplication3 C:\Qt\5.11.2\msvc2017_64\include\QtCore\qcompilerdetection.h 1327 
      Error (active) E2512 the argument to a feature-test macro must be a simple identifier QtGuiApplication3 C:\Qt\5.11.2\msvc2017_64\include\QtCore\qcompilerdetection.h 1329
      

      The lines are:

      #if defined(__cplusplus)
      #if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
      # define Q_FALLTHROUGH() [[clang::fallthrough]]
      #elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
      # define Q_FALLTHROUGH() [[gnu::fallthrough]]
      #elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
      # define Q_FALLTHROUGH() [[fallthrough]]
      #endif
      

       

      This is likely due to the colons in clang::fallthrough and gnu::fallthrough

      If the Errorlist in VS is changed from Build+IntelliSense to Build, the errors disappear and a build succeeds. Most likely, the Intellisense parser handles this differently from the compiler.

      Example Program

      #include <QApplication>
      
      #include <QLabel>
      
      int main(int argc, char* args[]){
      
      QApplication app(argc, args);
      
      QLabel label;
      
      label.setText("Hello World");
      
      label.show();
       app.exec();
      
      }
      

       

      Full VS configuration is attached.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            stefanbaerisch Stefan Baerisch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes