Compilation warning for C++20

Marc Glisse marc.glisse at inria.fr
Sat Apr 4 15:00:27 CEST 2026


Fixed in https://gmplib.org/repo/gmp/rev/1e504d187571

Thank you for the report, I hadn't heard about this before.

-- 
Marc Glisse

On Sat, 4 Apr 2026, Mathieu Dutour wrote:

> Hello,
>
> I recently switched to C++20 on MacOS and I have the following
> compilation warnings:
> -----
> /opt/homebrew/include/gmpxx.h:2163:29: warning: identifier '_mpz' preceded
> by whitespace in a literal operator declaration is deprecated
>      [-Wdeprecated-literal-operator]
> 2163 | inline mpz_class operator"" _mpz(const char* s)
>      |                  ~~~~~~~~~~~^~~~
>      |                  operator""_mpz
> /opt/homebrew/include/gmpxx.h:2168:29: warning: identifier '_mpq' preceded
> by whitespace in a literal operator declaration is deprecated
>      [-Wdeprecated-literal-operator]
> 2168 | inline mpq_class operator"" _mpq(const char* s)
>      |                  ~~~~~~~~~~~^~~~
>      |                  operator""_mpq
> /opt/homebrew/include/gmpxx.h:2175:29: warning: identifier '_mpf' preceded
> by whitespace in a literal operator declaration is deprecated
>      [-Wdeprecated-literal-operator]
> 2175 | inline mpf_class operator"" _mpf(const char* s)
>      |                  ~~~~~~~~~~~^~~~
>      |                  operator""_mpf
> -----
>
> The compiler version is
> -----
> ➜  src_poly git:(heads/master) ✗ g++ -v
> Apple clang version 21.0.0 (clang-2100.0.123.102)
> Target: arm64-apple-darwin25.4.0
> Thread model: posix
> InstalledDir:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
> -----
>
> and this is when compiling with "-Wall -Wextra".
>
>  Mathieu
> _______________________________________________
> gmp-bugs mailing list
> gmp-bugs at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-bugs


More information about the gmp-bugs mailing list