Compiling following code get error below.
Once I remove template<> from class R it inlines fine.

Yuri

--- begin code ---
#define inline __attribute__ ((__always_inline__))

template<class T> struct R { inline void R::r(int& c); };
template<class T> inline void R<T>::r(int& c) { }
class BB {};

void fffff(R<BB> *rr) {
  int i;
  rr->r(i);
}
--- end code ---

--- begin error ---
i.C: In function `void fffff(R<BB>*)':
i.C:6: sorry, unimplemented: inlining failed in call to 'void R<T>::r(int&)
[with T = BB]': function not inlinable
i.C:11: sorry, unimplemented: called from here
i.C: In function `void fffff(R<BB>*)':
i.C:6: sorry, unimplemented: inlining failed in call to 'void R<T>::r(int&)
[with T = BB]': function not inlinable
i.C:11: sorry, unimplemented: called from here
--- end error ---

-- 
           Summary: Mandatory inlining of templetized class member fails for
                    no reason
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yuri at tsoft dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to