www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - template bug

↑ ↓ ← Christof Meerwald <cmeerw web.de> writes:
template <class T>
struct N
{ };

template <class T>
struct L
{
  ~L()
  {
    int i = sizeof(N<T>);
  }
};

template <typename T> inline void checked_delete(T * x)
{
  typedef char type_must_be_complete[sizeof(T)];
  delete x;
}

template<typename T>
struct S
{
 public:
  template<typename Y> void f(Y y)
  {
    checked_delete<T>((T *) 0);
  }
};


struct A
{
  void f();
  void g();
};

inline void A::f()
{
  S<L<int> > i;
  i.f(0);
}
// Error: ';' expected following '}' of definition of class 'N<int >'

inline void A::g()
{ }

int main()
{
  A a;
  a.f();

  return 0;
}


Occurs when trying to compile Boost's signals library. Workaround is to add
the "missing" ';'.

BTW, should these bug reports be posted here or in c++.beta?


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Jan 09 2003
↑ ↓ → "Walter" <walter digitalmars.com> writes:
"Christof Meerwald" <cmeerw web.de> wrote in message
news:avjt6h$1k7h$1 digitaldaemon.com...
 BTW, should these bug reports be posted here or in c++.beta?

When I put out the next beta, yes.
Jan 09 2003