The following valid code snippet is rejected since GCC 3.4.2
(and in GCC 3.3.x):

=========================================================================
template<typename> struct A
{
    static void* operator new(__SIZE_TYPE__);
    template<typename T> friend void* A<T>::operator new(__SIZE_TYPE__);
};

A<int> a;
=========================================================================

bug.cc:4: error: invalid template declaration of 'static void* A<T>::operator
new(long unsigned int)'

We also get an ICE since GCC 3.4.2, which was fixed on mainline by the
patch for PR 27559. The ICE is dealt with in PR 27713.


-- 
           Summary: [4.0/4.1/4.2 regression] operator new as friend in
                    template class rejected
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, rejects-valid, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27714

Reply via email to