WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
74159
Fix HashMap<..., OwnPtr<...> >::add compilation errors
https://bugs.webkit.org/show_bug.cgi?id=74159
Summary
Fix HashMap<..., OwnPtr<...> >::add compilation errors
Adrienne Walker
Reported
2011-12-08 20:18:13 PST
Fix HashMap<..., OwnPtr<...> >::add compilation errors
Attachments
Patch
(1.36 KB, patch)
2011-12-08 20:34 PST
,
Adrienne Walker
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Adrienne Walker
Comment 1
2011-12-08 20:34:12 PST
Created
attachment 118521
[details]
Patch
Adrienne Walker
Comment 2
2011-12-08 20:37:21 PST
When I saw Adam's fix for
bug 73964
, I thought I'd take advantage of using an OwnPtr as the value for a HashMap in CCLayerTilingData. When I did this (see patch in
bug 74154
), I got the following compilation error: /usr/include/c++/4.4/bits/stl_pair.h: In constructor 'std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = std::pair<int, int>, _U2 = std::nullptr_t, _T1 = std::pair<int, int>, _T2 = WTF::OwnPtr<WebCore::CCLayerTilingData::Tile>]': /usr/include/c++/4.4/bits/stl_pair.h:101: error: no matching function for call to 'WTF::OwnPtr<WebCore::CCLayerTilingData::Tile>::OwnPtr(const std::nullptr_t&)' So, I added this missing function to OwnPtr.
Darin Adler
Comment 3
2011-12-09 10:37:40 PST
Comment on
attachment 118521
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=118521&action=review
> Source/JavaScriptCore/wtf/OwnPtr.h:44 > + explicit OwnPtr(const std::nullptr_t&) : m_ptr(0) { }
I see no reason for this to be explicit. This might work for some compilers, but with others I fear it may break the build. The EWS seems to like it OK. Since you did not include the entire error, I cannot be sure, but I suspect there may be a way to resolve this entirely in HashTraits.h. For example, it may be a simple matter of overloading some function to take a nullptr_t. I am not going to say review+ yet because of the “explicit” issue and the fact that I’d like to see the rest of the error.
Darin Adler
Comment 4
2011-12-09 10:40:17 PST
Comment on
attachment 118521
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=118521&action=review
r=me, but please land my revised version
>> Source/JavaScriptCore/wtf/OwnPtr.h:44 >> + explicit OwnPtr(const std::nullptr_t&) : m_ptr(0) { } > > I see no reason for this to be explicit. > > This might work for some compilers, but with others I fear it may break the build. The EWS seems to like it OK. > > Since you did not include the entire error, I cannot be sure, but I suspect there may be a way to resolve this entirely in HashTraits.h. For example, it may be a simple matter of overloading some function to take a nullptr_t. > > I am not going to say review+ yet because of the “explicit” issue and the fact that I’d like to see the rest of the error.
I changed my mind about all the rest of my comment. This is a good change. But we should not use “explicit” here. It’s good and helpful to allow implicit conversion from nullptr_t to OwnPtr. It should read: OwnPtr(std::nullptr_t) : m_ptr(0) { } There is no reason to use const std::nullptr_t& instead of just std::nullptr_t. See PassOwnPtr, which already has this constructor.
Adrienne Walker
Comment 5
2011-12-09 10:44:53 PST
(In reply to
comment #4
) >
> It should read: > > OwnPtr(std::nullptr_t) : m_ptr(0) { } > > There is no reason to use const std::nullptr_t& instead of just std::nullptr_t. See PassOwnPtr, which already has this constructor.
Thanks--both of those changes make a lot of sense. I'll land it exactly as above.
Adrienne Walker
Comment 6
2011-12-09 10:59:32 PST
Committed
r102459
: <
http://trac.webkit.org/changeset/102459
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug