Bug 140401 - Make WTF::Optional work with msvc 2013
Summary: Make WTF::Optional work with msvc 2013
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks: 140347
  Show dependency treegraph
 
Reported: 2015-01-13 11:45 PST by Chris Dumez
Modified: 2015-01-13 13:21 PST (History)
6 users (show)

See Also:


Attachments
Patch (5.14 KB, patch)
2015-01-13 11:57 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (5.04 KB, patch)
2015-01-13 12:22 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-01-13 11:45:14 PST
Make WTF::Optional work with mdvc 2013 by using std::aligned_memory instead of an unrestricted union internally. MSVC 2013 still does not support unrestricted unions.
Comment 1 Chris Dumez 2015-01-13 11:57:20 PST
Created attachment 244531 [details]
Patch
Comment 2 Anders Carlsson 2015-01-13 12:02:43 PST
Comment on attachment 244531 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=244531&action=review

> Source/WTF/wtf/Optional.h:65
> +            new (&m_value) T(*other.asPtr());

I still think you want NotNull here.

> Source/WTF/wtf/Optional.h:72
> +            new (&m_value) T(WTF::move(*other.asPtr()));

I still think you want NotNull here.

> Source/WTF/wtf/Optional.h:78
> +        new (&m_value) T(WTF::move(value));

NotNull.

> Source/WTF/wtf/Optional.h:85
> +        new (&m_value) T(std::forward<Args>(args)...);

NotNull.

> Source/WTF/wtf/Optional.h:106
> +            new (&m_value) T(*other.asPtr());

NotNull.

> Source/WTF/wtf/Optional.h:-138
> -    template<typename U>
> -    Optional& operator=(U&& u)

What happened to this overload?

> Source/WTF/wtf/Optional.h:119
> +            new (&m_value) T(WTF::move(*other.asPtr()));

NotNull.
Comment 3 Chris Dumez 2015-01-13 12:22:51 PST
Created attachment 244535 [details]
Patch
Comment 4 Chris Dumez 2015-01-13 12:24:15 PST
Comment on attachment 244531 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=244531&action=review

>> Source/WTF/wtf/Optional.h:65
>> +            new (&m_value) T(*other.asPtr());
> 
> I still think you want NotNull here.

Right, done.

>> Source/WTF/wtf/Optional.h:-138
>> -    Optional& operator=(U&& u)
> 
> What happened to this overload?

I had trouble getting it to build initially and forgot to add it back. It is back in.
Comment 5 WebKit Commit Bot 2015-01-13 13:21:40 PST
Comment on attachment 244535 [details]
Patch

Clearing flags on attachment: 244535

Committed r178372: <http://trac.webkit.org/changeset/178372>
Comment 6 WebKit Commit Bot 2015-01-13 13:21:46 PST
All reviewed patches have been landed.  Closing bug.