On 1/21/22 22:55, Jonathan Wakely wrote:
On Fri, 21 Jan 2022 at 17:42, Jonathan Wakely <jwak...@redhat.com> wrote:

On Fri, 21 Jan 2022 at 16:37, Robert-André Mauchin <zebo...@gmail.com> wrote:

On 1/21/22 14:46, Robert-André Mauchin wrote:
Hello,

So I built Clementine last week with no issue, but it failed during
the mass rebuild with the folloing error:

In file included from 
/builddir/build/BUILD/Clementine-0be314337d5bbd6fc7f5c76c31d7b87e37ba3a04/src/core/tagreaderclient.h:29,
                    from 
/builddir/build/BUILD/Clementine-0be314337d5bbd6fc7f5c76c31d7b87e37ba3a04/src/core/tagreaderclient.cpp:21:
/builddir/build/BUILD/Clementine-0be314337d5bbd6fc7f5c76c31d7b87e37ba3a04/ext/libclementine-common/core/workerpool.h:
 In instantiation of 'WorkerPool<HandlerType>::WorkerPool(QObject*) [with HandlerType 
= AbstractMessageHandler<cpb::tagreader::Message>]':
/builddir/build/BUILD/Clementine-0be314337d5bbd6fc7f5c76c31d7b87e37ba3a04/src/core/tagreaderclient.cpp:40:52:
    required from here
/builddir/build/BUILD/Clementine-0be314337d5bbd6fc7f5c76c31d7b87e37ba3a04/ext/libclementine-common/core/workerpool.h:168:55:
 error: passing 'QString' as 'this' argument discards qualifiers [-fpermissive]
     168 |   local_server_name_ = qApp->applicationName().toLower();
         |                                                       ^
In file included from /usr/include/qt5/QtCore/qhashfunctions.h:44,
                    from /usr/include/qt5/QtCore/qlist.h:47,
                    from /usr/include/qt5/QtCore/qstringlist.h:41,
                    from /usr/include/qt5/QtCore/QStringList:1,
                    from 
/builddir/build/BUILD/Clementine-0be314337d5bbd6fc7f5c76c31d7b87e37ba3a04/src/core/tagreaderclient.h:26:
/usr/include/qt5/QtCore/qstring.h:510:31: note:   in call to 'QString 
QString::toLower() &&'
     510 |     Q_REQUIRED_RESULT QString toLower() &&
         |                               ^~~~~~~


Nothing stands up to me in the linked code:

template <typename HandlerType>
WorkerPool<HandlerType>::WorkerPool(QObject* parent)
      : _WorkerPoolBase(parent), next_worker_(0), next_id_(0) {
    worker_count_ = qBound(1, QThread::idealThreadCount() / 2, 2);
    local_server_name_ = qApp->applicationName().toLower();

    if (local_server_name_.isEmpty()) local_server_name_ = "workerpool";
}


Anyone knows if a flag, or compiler, has changed since last week? Or have any 
input at all?

Best regards,

Robert-André

So the problem is specific to GCC 12 but I can't find anything in the changelog 
related to this.
It seems toLower() takes a const as input and qApp->applicationName() is not a 
const.

No, you have it backwards.

QString::toLower() && can only be called on a non-const rvalue, and
applicationName() is apparently returning a const object.


I solved by replacing
local_server_name_ = qApp->applicationName().toLower();
to
local_server_name_ = QString(qApp->applicationName()).toLower();

This creates an rvalue, which allows the call to toLower().

Still I would love for a GCC specialist to point me to the relevant change in 
GCC 12 so I can
send a patch upstream with explanation for the change.

The Qt code has two overloads:

     Q_REQUIRED_RESULT QString toLower() const &
     { return toLower_helper(*this); }
     Q_REQUIRED_RESULT QString toLower() &&
     { return toLower_helper(*this); }

For some reason, the second one is being used when it should be the first.

I don't think this is a GCC change though.

I was wrong, this is a weird GCC overload resolution bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104173


Thanks so much for looking it up!
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to