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

lupdate is confused by "class" within template angle brackets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P2: Important
    • None
    • 5.6.1, 5.9.2
    • Tools: Linguist

    Description

      When a class has any template with class inside the angle brackets in its header, lupdate is confused by the template.

      Examples:

      This one only reproduces with the class declaration in a separate header file.

      // main.h
      
      class Foo
      {
          Q_OBJECT
          template<class T>
          void func();
      }
      
      // main.cpp
      
      #include "main.h"
      
      template<class T>
      void Foo::func()
      {
          tr("Message"); // Context is T instead of Foo
      }

      This one reproduces within a single cpp file (notice the namespace).

      template<class T> class TempClass;
      
      namespace Ns {
      class SomeClass
      {
          Q_OBJECT
      
          void func();
      };
      
      void SomeClass::func()
      {
          tr("Message"); // error: Qualifying with unknown namespace/class ::SomeClass
      }
      } // namespace Ns

      The context here is SomeClass without the namespace.

      Using typename instead of class resolves this, but that's a bad workaround...

      Attachments

        Issue Links

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

          Activity

            People

              lugerard Lucie Gerard
              orgads Orgad Shaneh
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes