build error in xpcwrappedjsclass.cpp

RESOLVED FIXED in mozilla9

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: arno renevier, Unassigned)

Tracking

unspecified
mozilla9
x86_64
Linux
Points:
---

Firefox Tracking Flags

(firefox8 affected, firefox9 affected)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
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
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.
Assignee: nobody → general
Component: XPConnect → JavaScript Engine
QA Contact: xpconnect → general
(Reporter)

Comment 2

6 years ago
It looks like moveRef and moveConstructor was introduced in bug 672728
Blocks: 672728
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

6 years ago
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?).

Updated

6 years ago
Attachment #560394 - Flags: review?(jimb)
Duplicate of this bug: 687039
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*’
status-firefox8: --- → affected
status-firefox9: --- → affected

Comment 7

6 years ago
Is comment 6 with the patch applied?
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.

Updated

6 years ago
Attachment #560394 - Flags: review?(jimb) → review+
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 10

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/724207df257a
Whiteboard: [inbound]
Target Milestone: --- → mozilla9
https://hg.mozilla.org/mozilla-central/rev/724207df257a
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
You need to log in before you can comment on or make changes to this bug.