Skip to content

compile error with clang-22 on debian 11 #965

Closed

Description

@gvollant

I'm trying compile simdutf on my debian 11 comptuer, with clang-22 from https://apt.llvm.org

gillesvollant@gv-w11x64:/mnt/w/devw$ clang++-22 -std=c++23 -o vir exterieur/simdutf/singleheader/simdutf.cpp
In file included from exterieur/simdutf/singleheader/simdutf.cpp:3:
exterieur/simdutf/singleheader/simdutf.h:14111:10: error: no member named 'unreachable' in namespace 'std'
 14111 |     std::unreachable(); // invalid base64 input in _base64 literal
       |          ^~~~~~~~~~~
exterieur/simdutf/singleheader/simdutf.cpp:33262:32: warning: array index 2 is past the end of the array (that has type 'const simd8<unsigned char>[2]') [-Warray-bounds]
 33262 |         this->check_utf8_bytes(input.chunks[2], input.chunks[1]);
       |                                ^            ~
exterieur/simdutf/singleheader/simdutf.cpp:4826:3: note: array 'chunks' declared here
 4826 |   simd8<T> chunks[NUM_CHUNKS];
      |   ^
exterieur/simdutf/singleheader/simdutf.cpp:33263:32: warning: array index 3 is past the end of the array (that has type 'const simd8<unsigned char>[2]') [-Warray-bounds]
 33263 |         this->check_utf8_bytes(input.chunks[3], input.chunks[2]);
       |                                ^            ~
exterieur/simdutf/singleheader/simdutf.cpp:4826:3: note: array 'chunks' declared here
 4826 |   simd8<T> chunks[NUM_CHUNKS];
      |   ^
exterieur/simdutf/singleheader/simdutf.cpp:33263:49: warning: array index 2 is past the end of the array (that has type 'const simd8<unsigned char>[2]') [-Warray-bounds]
 33263 |         this->check_utf8_bytes(input.chunks[3], input.chunks[2]);
       |                                                 ^            ~
exterieur/simdutf/singleheader/simdutf.cpp:4826:3: note: array 'chunks' declared here
 4826 |   simd8<T> chunks[NUM_CHUNKS];
      |   ^
3 warnings and 1 error generated.

I've no error with --std=c++20

Activity

  1. pauldreik commented on Apr 25, 2026

    @pauldreik
    Collaborator

    This is probably because clang uses libstdc++ from the system, which is likely from gcc 10 on debian 11 (bullseye)
    According to compiler support std::unreachable it is not supported until libstdc++ 12.

    I think you have to either stick to c++20 or install a newer standard library. I made a try for a workaround in #966.

  2. pauldreik commented on Apr 25, 2026

    @pauldreik
    Collaborator

    @gvollant can you please test out the branch in the PR linked above?

  3. gvollant commented on Apr 25, 2026

    @gvollant
    ContributorAuthor

    @gvollant can you please test out the branch in the PR linked above?

    the fix solves the problem, thank you

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions