<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>66024</bug_id>
          
          <creation_ts>2011-08-10 17:09:50 -0700</creation_ts>
          <short_desc>nullptr can&apos;t be used for PassRefPtr</short_desc>
          <delta_ts>2011-08-11 19:39:33 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>66123</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="James Robinson">jamesr</reporter>
          <assigned_to name="James Robinson">jamesr</assigned_to>
          <cc>andersca</cc>
    
    <cc>bashi</cc>
    
    <cc>darin</cc>
    
    <cc>eric</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>449505</commentid>
    <comment_count>0</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-08-10 17:09:50 -0700</bug_when>
    <thetext>nullptr can&apos;t be used for PassRefPtr</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>449506</commentid>
    <comment_count>1</comment_count>
      <attachid>103561</attachid>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-08-10 17:10:12 -0700</bug_when>
    <thetext>Created attachment 103561
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>449508</commentid>
    <comment_count>2</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-08-10 17:12:45 -0700</bug_when>
    <thetext>When a function defined to return PassRefPtr&lt;T&gt; wants to return a null value, it currently has to do either:

  return 0;

which isn&apos;t as descriptive as it could be or

  return PassRefPtr&lt;T&gt;();

which can be a lot of typing if &quot;T&quot; is long.  It&apos;d be nice to be able to do

  return nullptr;

like you can for PassOwnPtr&lt;&gt;.

It looks like this functionality was added by Darin back in http://trac.webkit.org/changeset/69970 but then deleted by Anders in http://trac.webkit.org/changeset/89283.  I think the nullptr constructor was just an innocent victim in http://trac.webkit.org/changeset/89283 - it seems like something that we do want to support.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>449549</commentid>
    <comment_count>3</comment_count>
    <who name="Anders Carlsson">andersca</who>
    <bug_when>2011-08-10 18:33:29 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; When a function defined to return PassRefPtr&lt;T&gt; wants to return a null value, it currently has to do either:
&gt; 
&gt;   return 0;
&gt; 
&gt; which isn&apos;t as descriptive as it could be or
&gt; 
&gt;   return PassRefPtr&lt;T&gt;();
&gt; 
&gt; which can be a lot of typing if &quot;T&quot; is long.  It&apos;d be nice to be able to do
&gt; 
&gt;   return nullptr;
&gt; 
&gt; like you can for PassOwnPtr&lt;&gt;.
&gt; 

Yeah, I agree.

&gt; It looks like this functionality was added by Darin back in http://trac.webkit.org/changeset/69970 but then deleted by Anders in http://trac.webkit.org/changeset/89283.  I think the nullptr constructor was just an innocent victim in http://trac.webkit.org/changeset/89283 - it seems like something that we do want to support.

Looking at the commit, it looks like only the nullptr assignment operator was removed and that there was never a nullptr constructor (unless I&apos;m missing something).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>449973</commentid>
    <comment_count>4</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-08-11 13:13:09 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; When a function defined to return PassRefPtr&lt;T&gt; wants to return a null value, it currently has to do either:
&gt; &gt; 
&gt; &gt;   return 0;
&gt; &gt; 
&gt; &gt; which isn&apos;t as descriptive as it could be or
&gt; &gt; 
&gt; &gt;   return PassRefPtr&lt;T&gt;();
&gt; &gt; 
&gt; &gt; which can be a lot of typing if &quot;T&quot; is long.  It&apos;d be nice to be able to do
&gt; &gt; 
&gt; &gt;   return nullptr;
&gt; &gt; 
&gt; &gt; like you can for PassOwnPtr&lt;&gt;.
&gt; &gt; 
&gt; 
&gt; Yeah, I agree.
&gt; 
&gt; &gt; It looks like this functionality was added by Darin back in http://trac.webkit.org/changeset/69970 but then deleted by Anders in http://trac.webkit.org/changeset/89283.  I think the nullptr constructor was just an innocent victim in http://trac.webkit.org/changeset/89283 - it seems like something that we do want to support.
&gt; 
&gt; Looking at the commit, it looks like only the nullptr assignment operator was removed and that there was never a nullptr constructor (unless I&apos;m missing something).


Aha, you are correct.

Still, I think this patch is good.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>449981</commentid>
    <comment_count>5</comment_count>
    <who name="Anders Carlsson">andersca</who>
    <bug_when>2011-08-11 13:17:11 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; Aha, you are correct.
&gt; 
&gt; Still, I think this patch is good.

I agree. I&apos;m not sure if it&apos;ll break the C++0x build, but seeing as we don&apos;t have a C++0x build, I don&apos;t think we need to worry about that now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>450043</commentid>
    <comment_count>6</comment_count>
      <attachid>103561</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-08-11 14:40:04 -0700</bug_when>
    <thetext>Comment on attachment 103561
Patch

Clearing flags on attachment: 103561

Committed r92880: &lt;http://trac.webkit.org/changeset/92880&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>450044</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-08-11 14:40:08 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>450222</commentid>
    <comment_count>8</comment_count>
    <who name="Kenichi Ishibashi">bashi</who>
    <bug_when>2011-08-11 18:47:37 -0700</bug_when>
    <thetext>Hi,

This looks great, but the change causes a bunch of compile error when I build Chromium Win port with VS2010.  How can I fix the error?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>450223</commentid>
    <comment_count>9</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-08-11 18:48:56 -0700</bug_when>
    <thetext>Can you show me a link to a failing build or post the compile errors here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>450227</commentid>
    <comment_count>10</comment_count>
    <who name="Kenichi Ishibashi">bashi</who>
    <bug_when>2011-08-11 18:56:51 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; Can you show me a link to a failing build or post the compile errors here?

My build environment is Japanese so you might not get the error description, but the error code is C2668.
http://msdn.microsoft.com/en-us/library/da60x087(v=VS.100).aspx

c:\cygwin\home\bashi\chrome\src\third_party\webkit\source\javascriptcore\wtf\text\StringImpl.h(173): error C2668: &apos;WTF::PassRefPtr&lt;T&gt;::PassRefPtr&apos; : オーバーロード関数の呼び出しを解決することができません。(新機能 ; ヘルプを参照)
3&gt;          with
3&gt;          [
3&gt;              T=WTF::StringImpl
3&gt;          ]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>450230</commentid>
    <comment_count>11</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-08-11 19:07:13 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; (In reply to comment #9)
&gt; &gt; Can you show me a link to a failing build or post the compile errors here?
&gt; 
&gt; My build environment is Japanese so you might not get the error description, but the error code is C2668.
&gt; http://msdn.microsoft.com/en-us/library/da60x087(v=VS.100).aspx
&gt; 
&gt; c:\cygwin\home\bashi\chrome\src\third_party\webkit\source\javascriptcore\wtf\text\StringImpl.h(173): error C2668: &apos;WTF::PassRefPtr&lt;T&gt;::PassRefPtr&apos; : オーバーロード関数の呼び出しを解決することができません。(新機能 ; ヘルプを参照)
&gt; 3&gt;          with
&gt; 3&gt;          [
&gt; 3&gt;              T=WTF::StringImpl
&gt; 3&gt;          ]

Aha, this looks interesting (from the msdn page): &quot;You can also get this error through template use. If, in the same class, you have a regular member function and a templated member function with the same signature, the templated one must come first. This is a limitation of the current implementation of Visual C++.&quot;

Can you try swapping these two lines:
        PassRefPtr(std::nullptr_t) : m_ptr(0) { }
        PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }

and see if that fixes the issue for you?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>450241</commentid>
    <comment_count>12</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-08-11 19:37:27 -0700</bug_when>
    <thetext>So the problem is we have:
foo(void*) {}
foo(nullptr) {}

and VS2010 can&apos;t figure out what we mean when we do:
foo(0);

That&apos;s unfortunate.  I don&apos;t know any way to resolve this other than replacing all the code that does constructs a PassRefPtr&lt;&gt; with the literal 0 by nullptr, which will kind of suck.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>103561</attachid>
            <date>2011-08-10 17:10:12 -0700</date>
            <delta_ts>2011-08-11 14:40:04 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-66024-20110810171010.patch</filename>
            <type>text/plain</type>
            <size>1382</size>
            <attacher name="James Robinson">jamesr</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogOTI3OTkKZGlmZiAtLWdpdCBhL1NvdXJjZS9KYXZhU2NyaXB0
Q29yZS9DaGFuZ2VMb2cgYi9Tb3VyY2UvSmF2YVNjcmlwdENvcmUvQ2hhbmdlTG9nCmluZGV4IDI0
MGI1MmE0MDU5MzQ0NTVjMmM5NGNhZGQwZTNjNWJjNzg3MmZlZTEuLjE4NGUxNzAyNzRkND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