Closed
Bug 1601907
Opened 5 years ago
Closed 5 years ago
non-constexpr function 'length' cannot be used in a constant expression
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla73
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: Sylvestre, Assigned: Sylvestre)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Building with clang trunk
/var/lib/jenkins/workspace/firefox-clang-last/js/src/builtin/intl/NumberFormat.cpp:403:25: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
static constexpr size_t MaxUnitLength() {
^
/var/lib/jenkins/workspace/firefox-clang-last/js/src/builtin/intl/NumberFormat.cpp:408:31: note: non-constexpr function 'length' cannot be used in a constant expression
length = std::max(length, std::char_traits<char>::length(unit.subtype));
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/char_traits.h:266:7: note: declared here
length(const char_type* __s)
^
In file included from Unified_cpp_js_src5.cpp:2:
/var/lib/jenkins/workspace/firefox-clang-last/js/src/builtin/intl/NumberFormat.cpp:419:18: error: variable-sized object may not be initialized
char unitChars[MaxUnitLength() + 1] = {};
^~~~~~~~~~~~~~~~~~~
2 errors generated.
Maybe caused by the C++17 migration?
with clang version 10.0.0-+20191205115126+41eeded8043-1exp120191205105719.1634
Comment 1•5 years ago
|
||
This is because GCC 6.x's libstdc++ is not C++17 conformant. We could just disable the constexpr code path here (I have a local patch to do just that).
Assignee | ||
Comment 2•5 years ago
|
||
Updated•5 years ago
|
Assignee: nobody → sledru
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c1db977cabfe
Disable a code path when built with libstdc++ 6 and below r=froydnj
Comment 4•5 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 5 years ago
status-firefox73:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
Comment 5•5 years ago
|
||
This change actually causes the mentioned build failure on Ubuntu with clang 9 and libstdc++ 6 (gcc 8.3.0 and 9.2.1)
Building with clang 8 and libstdc++6 (gcc 5.4.0) seems to be not affected.
Assignee | ||
Comment 6•5 years ago
|
||
(In reply to Rico Tzschichholz from comment #5)
This change actually causes the mentioned build failure on Ubuntu with clang 9 and libstdc++ 6 (gcc 8.3.0 and 9.2.1)
could you please open a new bug for this?
thanks
You need to log in
before you can comment on or make changes to this bug.
Description
•