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

--- Comment #11 from seurer at gcc dot gnu.org ---
From, the original I cut it down to this.  Compiles OK with r14-4110, error
with r14-4111.


bad3.c: In member function 'NameIdPoolEnumerator<TElem>&
NameIdPoolEnumerator<TElem>::operator=(const NameIdPoolEnumerator<TElem>&)':
bad3.c:23:20: error: assignment of read-only location
'((NameIdPoolEnumerator<TElem>*)this)->NameIdPoolEnumerator<TElem>::fMemoryManager'
   23 |     fMemoryManager = toAssign.fMemoryManager;
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~



class MemoryManager;



template <class TElem> class NameIdPoolEnumerator// : public XMemory
{
public :
    NameIdPoolEnumerator<TElem>& operator=
    (
        const NameIdPoolEnumerator<TElem>& toAssign
    );

private :
    MemoryManager* const fMemoryManager;
};




template <class TElem> NameIdPoolEnumerator<TElem>&
NameIdPoolEnumerator<TElem>::
operator=(const NameIdPoolEnumerator<TElem>& toAssign)
{
    fMemoryManager = toAssign.fMemoryManager;
    return *this;
}

Reply via email to