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

Warning detected as error when compiling unused variables in function templates

    XMLWordPrintable

Details

    Description

      Although the build is successful, when compiling the following code with MinGW I get the Build Issues listing a red mark for the unused variable i inside the function template (please see attachment). With a non-template function the behavior is as expected. Note: The problem doesn't happen with the MSVC toolchain.

      template <class T>
      inline void g()

      { T i; /* Got red mark after build. */ }

      inline void f()

      { int i; /* Ok. */ }

      int main(int argc, char *argv[])
      {
      f();
      g<int>();

      return 0;
      }

      Attachments

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

        Activity

          People

            hunger Tobias Hunger
            leamelo Leandro T. C. Melo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes