-
Bug
-
Resolution: Won't Do
-
P1: Critical
-
None
-
6.9
-
None
The following code builds with Qt 6.8 and earlier
char16_t i = 42; QString foo = QStringLiteral("%1").arg(i, 4, 16, QLatin1Char('0')); qWarning() << foo;
It works and prints the expected "002a".
With 6.9 however it fails to build
foo.cpp:24:43: error: no matching function for call to ‘QString::arg(char16_t&, int, int, QLatin1Char)’
24 | QString foo = QStringLiteral("%1").arg(i, 4, 16, QLatin1Char('0'));
| ^
In file included from /home/nico/kde-qtdev/usr/include/QtCore/qobject.h:11,
from /home/nico/kde-qtdev/usr/include/QtCore/QObject:1,
from /home/nico/kde-qtdev/build/kcoreaddons/autotests/pch.h:2,
from /home/nico/kde-qtdev/build/kcoreaddons/autotests/CMakeFiles/tests_pch.dir/cmake_pch.hxx:5,
from <command-line>:
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:316:27: note: candidate: ‘template<class T, typename std::enable_if<conjunction_v<std::disjunction<std::is_convertible<T, long long unsigned int>, std::is_convertible<T, long long int> >, std::negation<std::disjunction<s
td::is_same<typename std::remove_cvref<_Tp>::type, _Float16>, std::is_same<typename std::remove_cvref<_Tp>::type, qfloat16>, std::is_floating_point<_Tp> > >, std::negation<std::conjunction<std::negation<QtPrivate::treat_as_integral_arg<typename std::remove_cv< <template
-parameter-1-1> >::type> >, std::is_convertible<T, QAnyStringView> > > >, bool>::type <anonymous> > QString QString::arg(T, int, int, QChar) const’
316 | [[nodiscard]] QString arg(T a, int fieldWidth = 0, int base = 10,
| ^~~
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:316:27: note: template argument deduction/substitution failed:
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:315:53: error: no type named ‘type’ in ‘struct std::enable_if<false, bool>’
315 | template <typename T, if_integral_non_char<T> = true>
| ^~~~
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:331:27: note: candidate: ‘template<class T, typename std::enable_if<std::disjunction<std::is_same<typename std::remove_cvref<_Tp>::type, _Float16>, std::is_same<typename std::remove_cvref<_Tp>::type, qfloat16>, std::is_f
loating_point<_Tp> >::value, bool>::type <anonymous> > QString QString::arg(T, int, char, int, QChar) const’
331 | [[nodiscard]] QString arg(T a, int fieldWidth = 0, char format = 'g', int precision = -1,
| ^~~
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:331:27: note: template argument deduction/substitution failed:
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:330:50: error: no type named ‘type’ in ‘struct std::enable_if<false, bool>’
330 | template <typename T, if_floating_point<T> = true>
| ^~~~
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:336:27: note: candidate: ‘template<class T, typename std::enable_if<std::conjunction<std::negation<QtPrivate::treat_as_integral_arg<typename std::remove_cv< <template-parameter-1-1> >::type> >, std::is_convertible<T, QAn
yStringView> >::value, bool>::type <anonymous> > QString QString::arg(const T&, int, QChar) const’
336 | [[nodiscard]] QString arg(const T &a, int fieldWidth = 0, QChar fillChar = u' ') const
| ^~~
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:336:27: note: candidate expects 3 arguments, 4 provided
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:356:5: note: candidate: ‘template<class ... Args> typename std::enable_if<((sizeof... (Args) >= 2) && conjunction_v<std::conjunction<std::negation<QtPrivate::treat_as_integral_arg<typename std::remove_cv<Args>::type> >,
std::is_convertible<Args, QAnyStringView> >...>), QString>::type QString::arg(Args&& ...) const’
356 | arg(Args &&...args) const
| ^~~
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:356:5: note: template argument deduction/substitution failed:
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h: In substitution of ‘template<class ... Args> typename std::enable_if<((sizeof... (Args) >= 2) && conjunction_v<std::conjunction<std::negation<QtPrivate::treat_as_integral_arg<typename std::remove_cv<Args>::type> >, std:
:is_convertible<Args, QAnyStringView> >...>), QString>::type QString::arg(Args&& ...) const [with Args = {char16_t&, int, int, QLatin1Char}]’:
/home/nico/kde-qtdev/src/kcoreaddons/autotests/kjobtest.cpp:24:43: required from here
24 | QString foo = QStringLiteral("%1").arg(i, 4, 16, QLatin1Char('0'));
| ^
/home/nico/kde-qtdev/usr/include/QtCore/qstring.h:356:5: error: no type named ‘type’ in ‘struct std::enable_if<false, QString>’
356 | arg(Args &&...args) const
| ^~~