Skip to content

Compilation error with Clang 20: deprecated literal operator operator"" _sv #3370

Closed
@nikindreus

Description

@nikindreus

Describe the bug

When building AWS SDK C++ version 1.11.539 with Clang 20 and C++20, the build fails due to deprecated syntax used in StringView.h, specifically the use of a whitespace between operator"" and _sv.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

The SDK should compile cleanly with Clang 20 and C++20 without triggering deprecated literal operator warnings/errors.

Current Behavior

/app/third_party/aws-sdk-cpp/crt/aws-crt-cpp/include/aws/crt/StringView.h:838:63: error: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
  838 |                 inline basic_string_view<char32_t> operator"" _sv(const char32_t *s, size_t length) noexcept
      |                                                    ~~~~~~~~~~~^~~
      |                                                    operator""_sv

Reproduction Steps

FROM ubuntu:25.04

WORKDIR /app

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -y \
      libarchive-dev \
      curl \
      libcurl4-openssl-dev \
      unzip \
      python3-dev autotools-dev libicu-dev libbz2-dev \
      cmake \
      clang-tidy \
      wget \
      valgrind \
      git \
      ninja-build  \
      autoconf libtool libtool-bin && \
    update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 100 && \
    update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 100 && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app/third_party

RUN git clone --recursive --branch=1.11.539 https://github.com/aws/aws-sdk-cpp.git && \
    cd aws-sdk-cpp && \
    cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel -DENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_ONLY="s3" && \
    cmake --build build --parallel 20 && \
    cmake --build build --target install && \
    cd .. && rm -r aws-sdk-cpp

Failed:

/app/third_party/aws-sdk-cpp/crt/aws-crt-cpp/include/aws/crt/StringView.h:838:63: error: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
  838 |                 inline basic_string_view<char32_t> operator"" _sv(const char32_t *s, size_t length) noexcept
      |                                                    ~~~~~~~~~~~^~~
      |                                                    operator""_sv

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.11.539

Compiler and Version used

clang version 20.1.1 / gcc 14.2.0

Operating System and version

ubuntu:25.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.pending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions