This is the mail archive of the gcc-bugs@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]

[Bug c++/14768] New: Bad diagnostics for call to dtor without object.


The following code:

// dtor.cc
struct Base
{
  ~Base () { } 
};

template <class C>
struct Derived: public Base
{ 
  ~Derived ()
  {
    Base::~Base();
  }	 
};


int main()
{
  Derived<int> A;
  return 0;
}

seqfaults on 3.3.3 with:
D:\simple>g++-3.3.3 dtor.cc 
dtor.cc: In destructor `Derived<C>::~Derived() [with C = int]':
dtor.cc:18:   instantiated from here
dtor.cc:2: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.mingw.org/bugs.shtml> for instructions.

On 3.4.0, no segfault. I get this diagnostic instead:

D:\simple>g++-3.4.0  dtor.cc 
dtor.cc: In destructor `Derived<C>::~Derived()':
dtor.cc:11: error: too few arguments to function
dtor.cc: In destructor `Derived<C>::~Derived() [with C = int]':
dtor.cc:18:   instantiated from here
dtor.cc:11: error: no matching function for call to `Derived<int>::Base()'
dtor.cc:3: note: candidates are: Base::~Base()

Better, but not as good as 2.95.3 which told me this:
D:\simple>g++-2  dtor.cc 
dtor.cc: In method `Derived<int>::~Derived()':
dtor.cc:18:   instantiated from here
dtor.cc:11: cannot call destructor `Base::~Base' without object

Danny

-- 
           Summary: Bad diagnostics for call to dtor without object.
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at users dot sourceforge dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-pc-mingw32
  GCC host triplet: i386-pc-mingw32
GCC target triplet: i386-pc-mingw32


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


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