Error compiling rooting headers with MSVC
Categories
(Core :: JavaScript: GC, defect)
Tracking
()
People
(Reporter: jonco, Unassigned)
Details
Attachments
(1 file)
946 bytes,
text/plain
|
Details |
We don't support building Mozilla code with MSVC since version 67, but to make life easier for embedders it would be better if it didn't fall over on our headers.
When I’m tryiing to build my testapp.cpp using spiderMonkey in visual studio 2019,it’s
giving compilation error from GCPolicyAPI.h(line:70) whenever i’m adding jsapi.h in my
program.
Error: error C2338: Pointer type not allowed for StructGCPolicy
It seems this can be fixed by defining a specialization for GCPolicy<void*>. I don't know if this is the right thing to do, and it would be better to understand what's going wrong before adding a workaround like this.
Original report on discourse: https://discourse.mozilla.org/t/compilation-error-with-jsapi-h-in-vs19-with-esr78/81380
Workaround in cairo: https://gitlab.gnome.org/GNOME/gjs/-/commit/60ae77b1d49e344a8b8e2b2a3c184e7d7f72676f
Comment 1•3 years ago
•
|
||
Here's the possibly minimal testcase.
Compiling this on VisualStudio 2019, with c++17 option hits the static_assert
, but not on clang.
Comment 2•3 years ago
|
||
So, in certain situation, MSVC instantiates unnecessary templates.
The "pointer type" assertion is supposed not to hit for T = RootListEntry*
, because T = RootListEntry*
case is used only for pointer type and it's not supposed to be instantiated,
but given above, MSVC instantiates the case, and hits the "pointer type" assertion.
Reporter | ||
Updated•3 years ago
|
Description
•