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

References to members of template arguments doesn't work when creator has seen a class by the same name in a different namepace

    XMLWordPrintable

Details

    • bfbf93e64f91630d7fad0bad1c4d38898ed5086b

    Description

      Consider the following code

      struct A {
          void foo();
      
          struct B {
              int b;
          };
      };
      
      template<typename T>
      struct Smart
      {
          T* get() { return 0; }
      };
      
      namespace foo {
          struct B {
          };
      }
      
      using namespace foo;
      
      void A::foo()
      {
          Smart<B> sb1;
          sb1.get()->b;
      
          Smart<A::B> sb2;
          sb2.get()->b;
      }
      

      Creator thinks that that "sb1.get()" returns an instance of the foo::B class but it in fact returns an instance of A::B, you can see this by placing the cursor on the lower case b, it doesn't reference anything. This works fine in a regular compiler like Clang or GCC.

      The "sb2.get()->b" statement works just fine.

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-9169
        # Subject Branch Project Status CR V

        Activity

          People

            kosjar Nikolai Kosjar
            jhanssen Jan Erik Hanssen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes