non-constexpr function 'length' cannot be used in a constant expression
Categories
(Core :: JavaScript Engine, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox71 | --- | unaffected |
firefox72 | --- | unaffected |
firefox73 | --- | fixed |
People
(Reporter: ricotz, Assigned: Sylvestre)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0
Steps to reproduce:
Building on Ubuntu with clang 9 and libstdc++ 6 (gcc 8.3.0 and 9.2.1) results in the exact failure claimed to be fixed in https://bugzilla.mozilla.org/show_bug.cgi?id=1601907
Actual results:
9:16.92 In file included from Unified_cpp_js_src5.cpp:2:
9:16.92 /<<PKGBUILDDIR>>/js/src/builtin/intl/NumberFormat.cpp:403:25: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
9:16.92 static constexpr size_t MaxUnitLength() {
9:16.92 ^
9:16.92 /<<PKGBUILDDIR>>/js/src/builtin/intl/NumberFormat.cpp:408:31: note: non-constexpr function 'length' cannot be used in a constant expression
9:16.93 length = std::max(length, std::char_traits<char>::length(unit.subtype));
9:16.93 ^
9:16.93 /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/char_traits.h:329:7: note: declared here
9:16.93 length(const char_type* __s)
9:16.93 ^
9:16.93 In file included from Unified_cpp_js_src5.cpp:2:
9:16.93 /<<PKGBUILDDIR>>/js/src/builtin/intl/NumberFormat.cpp:419:18: error: variable-sized object may not be initialized
9:16.93 char unitChars[MaxUnitLength() + 1] = {};
9:16.93 ^~~~~~~~~~~~~~~~~~~
Expected results:
Reverting https://hg.mozilla.org/mozilla-central/rev/c1db977cabfe fixed the failure.
Reporter | ||
Comment 1•4 years ago
|
||
Building with clang 8 and libstdc++6 (gcc 5.4.0) seems to be not affected.
Comment 2•4 years ago
|
||
That's weird...
What does GCC 9's bits/char_traits.h and bits/c++config.h look like?
Comment 3•4 years ago
|
||
Apparently we should be using _GLIBCXX_RELEASE
, which corresponds to the GCC version that owns the headers. But I still don't understand why the compilation is failing, because GCC 9's headers declare char_traits<T>::length
as constexpr
.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
Updated•4 years ago
|
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2ba741910e8f Use _GLIBCXX_RELEASE instead of __GLIBCXX__ r=froydnj
Comment 6•4 years ago
|
||
bugherder |
Assignee | ||
Comment 7•4 years ago
|
||
Rico, are we good now ?
thanks
Updated•4 years ago
|
Reporter | ||
Comment 8•4 years ago
|
||
(In reply to Sylvestre Ledru [:Sylvestre] from comment #7)
Rico, are we good now ?
thanks
No, still failing the same way
Reporter | ||
Comment 9•4 years ago
|
||
Updated•4 years ago
|
Reporter | ||
Comment 10•4 years ago
|
||
Updated•2 years ago
|
Description
•