https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104173

            Bug ID: 104173
           Summary: [12 Regression] wrong overload resolution for
                    ref-qualifiers
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

struct QString
{
  QString toLower() const&;
  QString toLower() &&;
};

struct QCoreApplication
{
  static QCoreApplication* self;
  static QCoreApplication *instance() { return self; }
  static QString applicationName();
};

template <typename HandlerType>
class WorkerPool  {
 public:
  WorkerPool();
};

template <typename HandlerType>
WorkerPool<HandlerType>::WorkerPool()
{
  QCoreApplication::instance()
    ->applicationName().toLower();
}

WorkerPool<int> w;



qual.C: In instantiation of 'WorkerPool<HandlerType>::WorkerPool() [with
HandlerType = int]':
qual.C:27:17:   required from here
qual.C:24:32: error: passing 'QString' as 'this' argument discards qualifiers
[-fpermissive]
   23 |   QCoreApplication::instance()
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
   24 |     ->applicationName().toLower();
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
qual.C:4:11: note:   in call to 'QString QString::toLower() &&'
    4 |   QString toLower() &&;
      |           ^~~~~~~

Reply via email to