https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120187
Bug ID: 120187
Summary: Inclusion of ciso646 incorrectly points to using
version in C++17 mode
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: dholmster at gmail dot com
Target Milestone: ---
Created attachment 61377
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61377&action=edit
Minimal reproduction generated using -save-temps
Hi,
After upgrading to GCC 15.1.0 (from 14.2.0) we are getting a warning (treated
as error in our builds) about the ciso646 header being deprecated and that we
should use the "version" header instead. I checked the C++17 draft (N4713,
2017-11-27) and found no mention of the "version" header in it, I do however
find it in the C++20 draft (N4860, 2020-03-31). Is it really correct to emit a
warning that version should be used instead of ciso646 when compiling with
-std=gnu++17?
> /usr/local/bin/g++-15.1.0 -DHAVE_ABSEIL -DHAVE_CPP_STDLIB -DNDEBUG
> -DOPENTELEMETRY_ABI_VERSION_NO=1 -DOPENTELEMETRY_STL_VERSION=2023
> -DPROTOBUF_USE_DLLS -D_FORTIFY_SOURCE=3 -D_GNU_SOURCE -isystem
> /path/to/source/staging/target/usr/local/include -flto=auto -ffat-lto-objects
> -fno-ipa-icf -march=core-avx2 -fno-omit-frame-pointer -Wall -Wextra -Werror
> -Wno-error=deprecated-declarations -Wstrict-aliasing=1 -fdiagnostics-color
> -ffile-prefix-map=/path/to/source=. -fstack-protector-strong
> -fstack-clash-protection -fcf-protection=full -O3 -ggdb -std=gnu++17 -fPIC
> -fdiagnostics-color=always -o repro.cc.o -c repro.cc
> In file included from
> /path/to/source/staging/target/usr/local/include/absl/hash/internal/hash.h:33,
> from
> /path/to/source/staging/target/usr/local/include/absl/hash/hash.h:89,
> from
> /path/to/source/staging/target/usr/local/include/absl/container/internal/hash_function_defaults.h:56,
> from
> /path/to/source/staging/target/usr/local/include/absl/container/hash_container_defaults.h:19,
> from
> /path/to/source/staging/target/usr/local/include/absl/container/flat_hash_map.h:43,
> from
> /path/to/source/staging/target/usr/local/include/google/protobuf/descriptor.h:46,
> from
> /path/to/source/staging/target/usr/local/include/google/protobuf/generated_message_reflection.h:25,
> from
> /path/to/source/staging/target/usr/local/include/opentelemetry/proto/collector/trace/v1/trace_service.pb.h:26,
> from
> /path/to/source/staging/target/usr/local/include/opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h:22,
> from
> /path/to/source/staging/target/usr/local/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h:13,
> from repo.cc:1:
> /usr/local/include/c++/15.1.0/ciso646:46:4: error: #warning "<ciso646> is
> deprecated in C++17, use <version> to detect implementation-specific macros"
> [-Werror=cpp]
> 46 | # warning "<ciso646> is deprecated in C++17, use <version> to detect
> implementation-specific macros"
> | ^~~~~~~
> cc1plus: all warnings being treated as errors
As you can see the warning is coming from abseil and they do support using the
version header but only when the code is being compiled as C++20 or later.
-
https://github.com/abseil/abseil-cpp/blob/20250127.1/absl/hash/internal/hash.h#L29-L34
We are unable to build this code using a later revision than C++17 at this
time.
Output of g++-15.1.0 -v:
> Using built-in specs.
> COLLECT_GCC=/usr/local/bin/g++-15.1.0
> COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-linux-gnu/15.1.0/lto-wrapperTarget:
> x86_64-linux-gnuConfigured with: ./configure --disable-maintainer-mode
> --build=x86_64-linux-gnu --program-suffix=-15.1.0 --enable-languages=c,c++
> --enable-lto --enable-libstdcxx-pch --enable-__cxa_atexit
> --enable-cloog-backend --enable-shared --enable-threads --enable-tls
> --enable-libsanitizer --with-system-zlib --disable-werror --disable-nls
> --disable-multilib --with-build-config=bootstrap-lto --with-gnu-as
> --with-as=/usr/local/bin/as --with-gnu-ld --with-ld=/usr/local/bin/ld
> CC='ccache /usr/bin/gcc-13' CXX='ccache /usr/bin/g++-13'Thread model:
> posixSupported LTO compression algorithms: zlib zstd
> gcc version 15.1.0 (GCC)