Title: [182254] trunk/Source/WTF
Revision
182254
Author
[email protected]
Date
2015-04-01 14:01:24 -0700 (Wed, 01 Apr 2015)

Log Message

015-04-01  Antti Koivisto  <[email protected]>

Value assignment operator of Optional should be stricter
https://bugs.webkit.org/show_bug.cgi?id=143303

Reviewed by Andreas Kling.

struct Foo { mutable Optional<std::chrono::seconds> s; };
Foo foo, foo2;
foo = foo2;

doesn't build because it tries to use wrong operator=.

* wtf/Optional.h:

    Add enable_if test similar to std::experimental::optional.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (182253 => 182254)


--- trunk/Source/WTF/ChangeLog	2015-04-01 19:58:39 UTC (rev 182253)
+++ trunk/Source/WTF/ChangeLog	2015-04-01 21:01:24 UTC (rev 182254)
@@ -1,3 +1,20 @@
+015-04-01  Antti Koivisto  <[email protected]>
+
+        Value assignment operator of Optional should be stricter
+        https://bugs.webkit.org/show_bug.cgi?id=143303
+
+        Reviewed by Andreas Kling.
+
+        struct Foo { mutable Optional<std::chrono::seconds> s; };
+        Foo foo, foo2;
+        foo = foo2;
+
+        doesn't build because it tries to use wrong operator=.
+
+        * wtf/Optional.h:
+
+            Add enable_if test similar to std::experimental::optional.
+
 2015-04-01  Alex Christensen  <[email protected]>
 
         Progress towards CMake on Windows and Mac.

Modified: trunk/Source/WTF/wtf/Optional.h (182253 => 182254)


--- trunk/Source/WTF/wtf/Optional.h	2015-04-01 19:58:39 UTC (rev 182253)
+++ trunk/Source/WTF/wtf/Optional.h	2015-04-01 21:01:24 UTC (rev 182254)
@@ -122,7 +122,7 @@
         return *this;
     }
 
-    template<typename U>
+    template<typename U, class = typename std::enable_if<std::is_same<typename std::remove_reference<U>::type, T>::value>::type>
     Optional& operator=(U&& u)
     {
         destroy();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to