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

strange behavior for operator* in nested template class

    XMLWordPrintable

Details

    Description

      struct Foo { int foo; };
      
      Foo global_t;
      
      template<class T>
      struct Outer
      {
          struct Nested
          {
              // doesn't work
              const T &operator*() const
              {
                  T *t = new T;
                  return *t;
              }
              // doesn't work
              const T &operator*() const
              {
                  return T();
              }
              // doesn't work
              const T &operator*() const
              {
                  return global_t;
              }
              // partially works (see QTCREATORBUG-9006)
              const T &operator*() const
              {
                  return local_t;
              }
              T local_t;
          };
      };
      
      void bug()
      {
          Outer<Foo>::Nested nested;
          (*nested).foo; // Not highlighted
      }

      Attachments

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

        Activity

          People

            orgads Orgad Shaneh
            orgads Orgad Shaneh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes