https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126254
Bug ID: 126254
Summary: GCC does not reject user specializations of
std::type_order as mandated
Product: gcc
Version: 16.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: programmer00001h at gmail dot com
Target Milestone: ---
Created attachment 65039
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65039&action=edit
Preprocessed version of erroneously accepted source code
Per [compare.type]#2 (https://eel.is/c++draft/compare.type#2),
> If an explicit specialization or partial specialization of type_order is
> declared, the program is ill-formed.
However, no diagnostic is emitted for the following program:
#include<compare>
namespace std{
template<>
struct type_order<int,float>{};
}
int main(){}
when saved as test.cpp and compiled with the command
g++ -std=c++26 -Wall -Wextra -Wpedantic -Werror test.cpp -o test
.
This is non-conforming because [compare.type]#2 did not specify "no diagnostic
required", therefore per [intro.compliance.general]#1, #2
(https://eel.is/c++draft/intro.compliance.general) a diagnostic must be issued.
Output of gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/16/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues
--with-build-config=bootstrap-lto --with-gcc-major-version-only
--with-linker-hash-style=gnu --with-system-zlib --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-fixincludes --disable-libssp
--disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.1.1 20260625 (GCC)