Compilation warning for C++20
Mathieu Dutour
mathieu.dutour at gmail.com
Sat Apr 4 13:13:11 CEST 2026
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
More information about the gmp-bugs
mailing list