Skip to content

missing C++20 safe integers comparisons (cmp_equal) in <utility> in C++20 mode #15851

Closed

Description

@manxorist
manx@gutemine:~/tmp$ cat test.cpp
#include <utility>
using std::cmp_equal;
using std::cmp_greater;
using std::cmp_greater_equal;
using std::cmp_less;
using std::cmp_less_equal;
using std::cmp_not_equal;
manx@gutemine:~/tmp$ em++ -std=c++20 -Wall -Wextra -Wpedantic -c test.cpp
test.cpp:2:12: error: no member named 'cmp_equal' in namespace 'std'
using std::cmp_equal;
      ~~~~~^
test.cpp:3:12: error: no member named 'cmp_greater' in namespace 'std'
using std::cmp_greater;
      ~~~~~^
test.cpp:4:12: error: no member named 'cmp_greater_equal' in namespace 'std'
using std::cmp_greater_equal;
      ~~~~~^
test.cpp:5:12: error: no member named 'cmp_less' in namespace 'std'
using std::cmp_less;
      ~~~~~^
test.cpp:6:12: error: no member named 'cmp_less_equal' in namespace 'std'
using std::cmp_less_equal;
      ~~~~~^
test.cpp:7:12: error: no member named 'cmp_not_equal' in namespace 'std'
using std::cmp_not_equal;
      ~~~~~^
6 errors generated.
em++: error: '/home/manx/opt/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=1 -D__EMSCRIPTEN_tiny__=0 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/home/manx/opt/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -std=c++20 -Wall -Wextra -Wpedantic -c test.cpp -o test.o' failed (returned 1)
manx@gutemine:~/tmp$ em++ --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.0 (8e1e305519e1027726a48861a1fec5662f7e18a2)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

manx@gutemine:~/tmp$ /home/manx/opt/emsdk/upstream/bin/clang++ --version
clang version 14.0.0 (https://github.com/llvm/llvm-project 1a929525e86a20d0b3455a400d0dbed40b325a13)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/manx/opt/emsdk/upstream/bin

_LIBCPP_VERSION is also 14000 in my Emscripten, and regular clang supports these templates as of version 13 (see https://godbolt.org/z/11MYzq9eb), so I am not really sure what's going wrong here.

Activity

  1. sbc100 commented on Dec 28, 2021

    @sbc100
    Collaborator

    I imagine this is because the libc++ and libc++abi libraries that we ship in emscripten are from 12.0.0 and this was not supported in that version of those libraries.

    Hopefully this will be fixed if we address #15396.

  2. manxorist commented on Dec 28, 2021

    @manxorist
    ContributorAuthor

    Well, that of course makes sense. It looks like I looked at the wrong libc++ headers in emsdk:
    ./upstream/include/c++/v1/__config is 14.0
    while
    ./upstream/emscripten/system/lib/libcxx/include/__config is 12.0

    I agree, this issue should be fixed automatically once #15396 gets fixed.

  3. manxorist commented on Jan 12, 2022

    @manxorist
    ContributorAuthor

    Works in 3.1.1, as expected.

    Closing this issue, as it has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions