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

Nested foreach generate warnings

    XMLWordPrintable

Details

    • 9940e4812ba3448a997cb8fb1b08187a84c797f2 (qt/qtbase/dev) 23c51da465ded21cc0dede98bfcc10a595caee5d (qt/qtbase/6.2) 826e076ef53a5809dee7d887b16ed961895049ea (qt/tqtc-qtbase/5.15)

    Description

      With the use of nested foreach, we obtain the following warning:

      warning C4456: declaration of '_container_' hides previous local declaration

      This is obtained with the following code:

      QList<int> aList;
      QList<int> bList;
      foreach(int a, aList)
      {
        Q_UNUSED(a);
        foreach(int b, bList)
        {
          Q_UNUSED(b);
        }
      }
      

      I'm using Visual Studio 2015 update 3, with the .Net framework 4.7.02556

      This warning becomes an issue when we activate the warnings as error, to guaranty a clean code.

      Attachments

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

        Activity

          People

            ievgenii.meshcheriakov Ievgenii Meshcheriakov
            benoit_siem Benoit Regrain
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes