Last Comment Bug 686280 - build error in xpcwrappedjsclass.cpp
: build error in xpcwrappedjsclass.cpp
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
: -- normal (vote)
: mozilla9
Assigned To: general
:
Mentors:
: 687039 (view as bug list)
Depends on:
Blocks: 672728
  Show dependency treegraph
 
Reported: 2011-09-12 01:28 PDT by arno renevier
Modified: 2011-09-20 07:38 PDT (History)
8 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
affected
affected


Attachments
adds in a new const stripping variant of Move (634 bytes, patch)
2011-09-15 10:33 PDT, Marty Rosenberg [:mjrosenb]
jimb: review+
Details | Diff | Splinter Review

Description arno renevier 2011-09-12 01:28:32 PDT
Hi,
I currently cannot build mozilla anymore. I get following error:

In file included from /home/arno/mozilla/js/src/jsobj.h:59:0,
                 from /home/arno/mozilla/js/src/xpconnect/src/xpcpublic.h:45,
                 from /home/arno/mozilla/js/src/xpconnect/src/xpcprivate.h:53,
                 from /home/arno/mozilla/js/src/xpconnect/src/xpcwrappedjsclass.cpp:45:
/home/arno/mozilla/js/src/jsvector.h: In static member function ‘static void js::VectorImpl<T, N, AP, IsPod>::moveConstruct(T*, const U*, const U*) [with U = js::Value, T = js::Value, long unsigned int N = 8ul, AP = js::TempAllocPolicy, bool IsPod = false]’:
/home/arno/mozilla/js/src/jsvector.h:620:5:   instantiated from ‘bool js::Vector<T, MinInlineCapacity, AllocPolicy>::convertToHeapStorage(size_t) [with T = js::Value, long unsigned int N = 8ul, AllocPolicy = js::TempAllocPolicy, size_t = long unsigned int]’
/home/arno/mozilla/js/src/jsvector.h:637:34:   instantiated from ‘bool js::Vector<T, MinInlineCapacity, AllocPolicy>::growStorageBy(size_t) [with T = js::Value, long unsigned int N = 8ul, AllocPolicy = js::TempAllocPolicy, size_t = long unsigned int]’
/home/arno/mozilla/js/src/jsvector.h:673:5:   instantiated from ‘bool js::Vector<T, MinInlineCapacity, AllocPolicy>::growByImpl(size_t) [with bool InitNewElems = false, T = js::Value, long unsigned int N = 8ul, AllocPolicy = js::TempAllocPolicy, size_t = long unsigned int]’
/home/arno/mozilla/js/src/jsvector.h:699:34:   instantiated from ‘bool js::Vector<T, MinInlineCapacity, AllocPolicy>::growByUninitialized(size_t) [with T = js::Value, long unsigned int N = 8ul, AllocPolicy = js::TempAllocPolicy, size_t = long unsigned int]’
/home/arno/mozilla/js/src/jscntxt.h:2432:9:   instantiated from ‘bool js::AutoVectorRooter<T>::resize(size_t) [with T = js::Value, size_t = long unsigned int]’
/home/arno/mozilla/js/src/xpconnect/src/xpcwrappedjsclass.cpp:1462:26:   instantiated from here
/home/arno/mozilla/js/src/jsvector.h:93:13: error: call of overloaded ‘Value(js::MoveRef<const js::Value>)’ is ambiguous
/home/arno/mozilla/js/src/jsvector.h:93:13: note: candidates are:
/home/arno/mozilla/js/src/jsvalue.h:334:7: note: constexpr js::Value::Value(const js::Value&)
/home/arno/mozilla/js/src/jsvalue.h:334:7: note: constexpr js::Value::Value(js::Value&&)
make[6]: *** [xpcwrappedjsclass.o] Erreur 1

I'm using gcc-4.6
Here is my .mozconfig:


mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-builddir

mk_add_options MOZ_BUILD_PROJECTS="xulrunner browser"
mk_add_options MOZ_CO_PROJECT="xulrunner browser"
ac_add_app_options xulrunner --enable-application=xulrunner
ac_add_app_options browser --enable-application=browser
mk_add_options MOZ_MAKE_FLAGS="-j2"

ac_add_options --disable-crashreporter
ac_add_options --disable-javaxpcom
ac_add_options --enable-chrome-format=flat
ac_add_options --with-system-zlib
ac_add_options --with-system-jpeg
ac_add_options --with-system-bz2
ac_add_options --with-system-sqlite
ac_add_options --enable-system-cairo
ac_add_options --disable-debug-symbols
Comment 1 Zack Weinberg (:zwol) 2011-09-12 08:17:41 PDT
I am getting this too.  It looks more of a JS core issue than an XPConnect issue to me.  And probably a case of gcc 4.6 being pickier than previous versions.
Comment 2 arno renevier 2011-09-12 15:07:52 PDT
It looks like moveRef and moveConstructor was introduced in bug 672728
Comment 3 Marty Rosenberg [:mjrosenb] 2011-09-15 10:33:07 PDT
Created attachment 560394 [details] [diff] [review]
adds in a new const stripping variant of Move

Thanks Luke, for being the unholy master of C++ and writing the whole patch on my laptop.  I'll let you explain what is actually going wrong here.
Comment 4 Luke Wagner [:luke] 2011-09-15 11:23:43 PDT
According to the error message, the problem is that are trying to construct a js::Value given a const js::Value & and there is an ambiguity between Value(const Value &) and Value(Value &&) (yes, that is the C++11 "rval reference").  This is insane so I assume something in GCC is broken, either the check or the error message.  Anyhow, the patch simply fixes the fact that if you "move" from a temporary (of type const T &), you should get a MoveRef<T>, not MoveRef<const T> (otherwise, how could you steal the temporary's guts?).
Comment 5 Mike Hommey [:glandium] 2011-09-16 02:04:41 PDT
*** Bug 687039 has been marked as a duplicate of this bug. ***
Comment 6 Mike Hommey [:glandium] 2011-09-16 02:05:24 PDT
Without -std=gnu++0x, the error becomes:
In file included from /mnt/js/src/jsobj.h:59:0,
                 from /mnt/js/src/xpconnect/src/xpcpublic.h:45,
                 from /mnt/js/src/xpconnect/src/xpcprivate.h:53,
                 from /mnt/js/src/xpconnect/src/xpcwrappedjsclass.cpp:45:
/mnt/js/src/jsvector.h: In static member function ‘static void js::VectorImpl<T, N, AP, IsPod>::moveConstruct(T*, const U*, const U*) [with U = js::Value, T = js::Value, long unsigned int N = 8ul, AP = js::TempAllocPolicy, bool IsPod = false]’:
/mnt/js/src/jsvector.h:620:5:   instantiated from ‘bool js::Vector<T, MinInlineCapacity, AllocPolicy>::convertToHeapStorage(size_t) [with T = js::Value, long unsigned int N = 8ul, AllocPolicy = js::TempAllocPolicy, size_t = long unsigned int]’
/mnt/js/src/jsvector.h:637:34:   instantiated from ‘bool js::Vector<T, MinInlineCapacity, AllocPolicy>::growStorageBy(size_t) [with T = js::Value, long unsigned int N = 8ul, AllocPolicy = js::TempAllocPolicy, size_t = long unsigned int]’
/mnt/js/src/jsvector.h:673:5:   instantiated from ‘bool js::Vector<T, MinInlineCapacity, AllocPolicy>::growByImpl(size_t) [with bool InitNewElems = false, T = js::Value, long unsigned int N = 8ul, AllocPolicy = js::TempAllocPolicy, size_t = long unsigned int]’
/mnt/js/src/jsvector.h:699:34:   instantiated from ‘bool js::Vector<T, MinInlineCapacity, AllocPolicy>::growByUninitialized(size_t) [with T = js::Value, long unsigned int N = 8ul, AllocPolicy = js::TempAllocPolicy, size_t = long unsigned int]’
/mnt/js/src/jscntxt.h:2432:9:   instantiated from ‘bool js::AutoVectorRooter<T>::resize(size_t) [with T = js::Value, size_t = long unsigned int]’
/mnt/js/src/xpconnect/src/xpcwrappedjsclass.cpp:1462:26:   instantiated from here
/mnt/js/src/jsvector.h:93:13: error: invalid cast from type ‘js::MoveRef<const js::Value>’ to type ‘const js::Value*’
Comment 7 Luke Wagner [:luke] 2011-09-16 09:07:58 PDT
Is comment 6 with the patch applied?
Comment 8 Mike Hommey [:glandium] 2011-09-16 09:25:10 PDT
No, it was just for reference, as the error makes more sense there. Sorry for the confusion. The patch does solve the problem for me.
Comment 9 Zack Weinberg (:zwol) 2011-09-16 21:49:37 PDT
Minimized test case:

    template <typename T> struct MoveRef { operator T& () {} };
    template <typename T> MoveRef <T> Move(T&) {}
    struct Thing {};
    Thing foo(const Thing* p) { return Thing(Move(*p)); }

Filed http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50442 .
Comment 11 :Ehsan Akhgari (away Aug 1-5) 2011-09-20 07:38:58 PDT
https://hg.mozilla.org/mozilla-central/rev/724207df257a

Note You need to log in before you can comment on or make changes to this bug.