This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4 + no inline template functions => undefined symbol ! ?


Hi Sébastien,

>May be gcc 4 just support inline functions for templates? (but why gcc 3.4 has no problem with that?)

GCC 4 supports non-inline functions for templates for me, just fine.

template <typename T>
T NonInline(T input)
{
    return input - 1;
}

template <typename T>
inline T Inline(T input)
{
    return input + 1;
}

int main()
{
    int i = 10;
    i = NonInline(i);
    i = NonInline(i);
    i = NonInline(i);
    i = NonInline(i);

    int j = 10;
    j = Inline(j);
    j = Inline(j);
    j = Inline(j);
    j = Inline(j);
}

Sincerely,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]