emscripten-core / emscripten-core/emsdk

Regression in 3.1.68 : fmtlib/fmt compilation failure with error : "not a constant expression"

Open
#1,480 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.7k
Forks
821
Avg merge
1h 25m
Merged PRs (30d)
3

Description

"3.1.67" version compiles fine. But "3.1.68" fails to compile fmtlib/fmt library.

The main error seems to be that the iterator arithmetic is not constant expression

```
'parse_replacement_field> &>(&"{}"[1], &"{}"[2], checker(s))'
2613 | begin = p = parse_replacement_field(p - 1, end, handler);
```

Full call log

```
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/color.h:473:12: error: call to consteval function 'fmt::basic_format_string>::basic_format_string' is not a constant expression
473 | print(f, FMT_STRING("{}"), string_view(buf.begin(), buf.size()));
| ^
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/format.h:1827:23: note: expanded from macro 'FMT_STRING'
1827 | #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, )
| ^
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/format.h:1806:3: note: expanded from macro 'FMT_STRING_IMPL'
1806 | [] { \
| ^
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/base.h:779:54: note: subexpression not valid in a constant expression
779 | format_str_.remove_prefix(detail::to_unsigned(it - begin()));
| ~~~^~~~~~~~~
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/base.h:2761:5: note: in call to 'this->context_.advance_to(&"{}"[1])'
2761 | context_.advance_to(begin);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/base.h:2756:5: note: in call to 'this->on_format_specs(0, &"{}"[1], &"{}"[1])'
2756 | on_format_specs(id, begin, begin); // Call parse() on empty specs.
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/base.h:2581:5: note: in call to 'handler.on_replacement_field(0, &"{}"[1])'
2581 | handler.on_replacement_field(handler.on_arg_id(), begin);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/base.h:2613:21: note: in call to 'parse_replacement_field> &>(&"{}"[1], &"{}"[2], checker(s))'
2613 | begin = p = parse_replacement_field(p - 1, end, handler);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/base.h:2884:7: note: in call to 'parse_format_string>>({&"{}"[0], 2}, checker(s))'
2884 | detail::parse_format_string(str_, checker(s));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ankurv/vcpkg.test/installed/wasm32-emscripten/include/fmt/color.h:473:12: note: in call to 'basic_format_string([] {
struct __attribute__((visibility("hidden"))) FMT_COMPILE_STRING : fmt::detail::compile_string {
using char_type [[maybe_unused]] = fmt::remove_cvref_t;
[[maybe_unused]] constexpr operator fmt::basic_string_view() const {
return fmt::detail_exported::compile_string_to_view("{}");
}
};
return FMT_COMPILE_STRING();
}())'
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.