Closed Bug 771048 Opened 12 years ago Closed 12 years ago

cannot instanciate nsAutoRef<T>::swap()

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: vicamo, Assigned: vicamo)

Details

Attachments

(1 file, 2 obsolete files)

struct A {};

  template <>
  class nsAutoRefTraits<A>
    : public nsPointerRefTraits<A>
  {
  public:
    static void Release(A *ptr) {}
    static void AddRef(A *ptr) {}
  };

  nsCountedRef<A> a, b;
  a.swap(b);

Code above generates compile time error:

  ../../dist/include/nsAutoRef.h:189: error: no matching function for call to 'nsAutoRefBase<TestObjectA>::LocalSimpleRef::operator=(nsAutoRef<TestObjectA>* const)'
  ../../dist/include/nsAutoRef.h:491: note: candidates are: nsSimpleRef<TestObjectA>& nsSimpleRef<TestObjectA>::operator=(const nsSimpleRef<TestObjectA>&)
Attached patch v0 (obsolete) — Splinter Review
Assignee: nobody → vyang
Attachment #639229 - Flags: review?(khuey)
Comment on attachment 639229 [details] [diff] [review]
v0

Review of attachment 639229 [details] [diff] [review]:
-----------------------------------------------------------------

The change to nsAutoRef.h is fine, but your test is not.  You need to use the passed/fail functions from http://mxr.mozilla.org/mozilla-central/source/xpcom/tests/TestHarness.h to get your test to work properly on our build machines.
Attachment #639229 - Flags: review?(khuey) → review-
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #2)
> Comment on attachment 639229 [details] [diff] [review]
> v0
> 
> Review of attachment 639229 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> The change to nsAutoRef.h is fine, but your test is not.  You need to use
> the passed/fail functions from
> http://mxr.mozilla.org/mozilla-central/source/xpcom/tests/TestHarness.h to
> get your test to work properly on our build machines.

Thank you. I'll check what should I do then.
Try run for c1a427dbcd07 is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=c1a427dbcd07
Results (out of 217 total builds):
    success: 196
    warnings: 16
    failure: 5
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/vyang@mozilla.com-c1a427dbcd07
Attached patch v1 (obsolete) — Splinter Review
Attachment #639229 - Attachment is obsolete: true
Attachment #640175 - Flags: review?(khuey)
Comment on attachment 640175 [details] [diff] [review]
v1

Review of attachment 640175 [details] [diff] [review]:
-----------------------------------------------------------------

Please add a license header to TestAutoRef.cpp

r=me
Attachment #640175 - Flags: review?(khuey) → review+
Attached patch v2Splinter Review
Address review comment #6. Thanks, Kyle.
Attachment #640175 - Attachment is obsolete: true
Attachment #640245 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/84623518d428
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.