[webkit-reviews] review requested: [Bug 113454] GCC 4.8 error - C++ nested class inheriting enclosing class : [Attachment 195425] The is a patch.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 27 16:09:01 PDT 2013


Han Shen <shenhan at google.com> has asked  for review:
Bug 113454: GCC 4.8 error - C++ nested class inheriting enclosing class
https://bugs.webkit.org/show_bug.cgi?id=113454

Attachment 195425: The is a patch.
https://bugs.webkit.org/attachment.cgi?id=195425&action=review

------- Additional Comments from Han Shen <shenhan at google.com>
In WebKit/Source/WTF/wtf/HashMap.h, HashMapKeysProxy and HashMapValuesProxy are
defined as nested class inside HashMap, meanwhile they inherit the enclosing
HashMap class, which by any means is not legal. 

GCC 4.8 complains about this.

So the original code is like - 

template class <typename T>
class HashMap {
  ... ...
  ... ...
private:
  class HashMapKeysProxy;

  class HashMapKeysProxy : private HashMap {
  };
  ... ...
  ... ...
};

My fix is to change the above to:
template class <typename T>
class HashMap {
  ... ...
  ... ...
private:
  class HashMapKeysProxy;

  ... ...
  ... ...
};

template <typename T>
class HashMap<T>::HashMapKeysProxy : private HashMap<T> {
  ... ...
};


The patch is attached.


More information about the webkit-reviews mailing list