Give LinkedListElement a thisDuringConstruction() method, and use it in member initialization to silence an MSVC compiler warning. No bug, r=sparky
authorJeff Walden <jwalden@mit.edu>
Thu, 18 Oct 2012 18:39:54 -0700
changeset 110929 d5e23f4018c67d62d9c393544fae0c6f8e7c5f8b
parent 110928 db769c0adc2a52dd6c9e994f47466106a28ceb1d
child 110930 499ca9ee03bca43676218bbf5dba8e55f100a362
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerssparky
milestone19.0a1
Give LinkedListElement a thisDuringConstruction() method, and use it in member initialization to silence an MSVC compiler warning. No bug, r=sparky
mfbt/LinkedList.h
--- a/mfbt/LinkedList.h
+++ b/mfbt/LinkedList.h
@@ -96,18 +96,24 @@ class LinkedListElement
      * lists, and supporting this painlessly was a key design criterion.
      */
 
   private:
     LinkedListElement* next;
     LinkedListElement* prev;
     const bool isSentinel;
 
+    LinkedListElement* thisDuringConstruction() { return this; }
+
   public:
-    LinkedListElement() : next(this), prev(this), isSentinel(false) { }
+    LinkedListElement()
+      : next(thisDuringConstruction()),
+        prev(thisDuringConstruction()),
+        isSentinel(false)
+    { }
 
     /*
      * Get the next element in the list, or NULL if this is the last element in
      * the list.
      */
     T* getNext() {
       return next->asT();
     }