Bug 14189 - template inlining failed warning - with optimization -O2
Summary: template inlining failed warning - with optimization -O2
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-18 11:55 UTC by yotamm
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host: i586-suse-linux
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yotamm 2004-02-18 11:55:49 UTC
swlab35:39> cat Y.cpp
// Following fails when compiled by g++-3.3.1 with:
//   g++ -O2 -fno-exceptions -Winline -Werror
class Gin
{
 public:
    Gin();
    virtual ~Gin() {}
    void up() const;
}; // Gin

template<class T>
class Kup
{
    public:
        Kup(): _p(0) {}
        Kup(T p): _p(p) {
            if (_p)
            {
                _p->up();
            }
        }
    T _p;
}; // Kup


class HCABase : public Gin
{
 public:
    HCABase();
    virtual ~HCABase();
}; /* HCABase */

class WQ
{
 public:
    WQ(HCABase* h);
    virtual ~WQ();
    Kup<HCABase*>     _hca;
}; // WQ


WQ::WQ(HCABase* h) :
    _hca(h)
{
} // WQ::WQ
swlab35:40> g++ -O2 -fno-exceptions -Winline -c -o /tmp/Y.o Y.cpp
Y.cpp: In member function `WQ::WQ(HCABase*)':
Y.cpp:16: warning: inlining failed in call to `Kup<T>::Kup(T) [with T = 
   HCABase*]'
Y.cpp:44: warning: called from here
Y.cpp: In member function `WQ::WQ(HCABase*)':
Y.cpp:16: warning: inlining failed in call to `Kup<T>::Kup(T) [with T = 
   HCABase*]'
Y.cpp:44: warning: called from here
swlab35:41>
Comment 1 Andrew Pinski 2004-02-18 13:11:20 UTC
What target is this on, as I cannot reproduce it on i686-pc-linux-gnu or powerpc-apple-darwin?
Comment 2 yotamm 2004-02-18 16:21:26 UTC
(In reply to comment #1)
> What target is this on, as I cannot reproduce it on i686-pc-linux-gnu or
powerpc-apple-darwin?

I hope this answers teh above:

uname -a; arch
Linux swlab35 2.6.2 #5 SMP Wed Feb 11 15:41:53 IST 2004 i686 i686 i386 GNU/Linux
i686

Comment 3 Andrew Pinski 2004-04-17 15:21:10 UTC
This works for me on the released version of 3.3.3.  This might have been a bug in your 
vender's gcc.