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

Build issue with MSVC + /permissive- - Issue 1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.9.0 Beta 2
    • None
    • f46977ae785632e52fc7212265f2e1e0d38565db

      In function 'QNetworkInfoPrivate::networkName' (see file 'src\qtsystems\src\systeminfo\windows\qnetworkinfo_win.cpp'):

      for (uint i = 0; i < ssid.uSSIDLength;i++)  {
           QString temp = ssid.ucSSID[i];
           netname += temp;
      }
      

      'ssid.ucSSID[I]' has type 'UCHAR' (unsigned char).

      It can be simplified as:

      using uchar = unsigned char;
      
      struct QChar {
          QChar(int);
          explicit QChar(uchar);
      };
      struct QString {
          QString(QChar);
      };
      
      void f() {
          uchar c = 0;
          QString s = c;
      }
      

      This code is ill-formed because it involves two user-defined conversions. 'c' to 'QChar', then 'QChar' to 'QString'.

      MSVC allows two user-defined conversions by default. When /permissive- is used, it will align with other compilers and reject the code.

      Based on my limited understanding of the code, looks that the intention is to use QChar and it will fix the code:

      QChar temp = ssid.ucSSID[i];
      netname += temp;
      

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

            lpotter Lorn Potter
            xiangfan Xiang Fan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes