Topic: explicit dtor call and typedefs
Author: James Kuyper <kuyper@wizard.net>
Date: 1998/05/11 Raw View
Maurizio Vitale wrote:
>
> is the following legal according to the latest version of the standard?
>
> Code similar to this is used in LEDA (a library of data structures and
> algorithms) and a recent snapshot of egcs [gcc version egcs-2.91.25
> 19980425 (gcc2 ss-980401 experimental)] doesn't like it.
>
> class C {};
>
> typedef C A;
>
> main()
> {
> A* p = new A;
> p->~A();
> }
When asking for advice about why some code wouldn't compile, you should
generally include a copy of the actual code of the simplest program that
you could write that displays the same problem, and a copy of the
compiler's error and warning messages. Explaining an error that a
compiler detects is often much easier than detecting it yourself.
Offhand, I can't see any problem with the above code, and neither does
the compiler I just checked it with.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Maurizio Vitale <vitale@esat.kuleuven.ac.be>
Date: 1998/05/07 Raw View
is the following legal according to the latest version of the standard?
Code similar to this is used in LEDA (a library of data structures and
algorithms) and a recent snapshot of egcs [gcc version egcs-2.91.25
19980425 (gcc2 ss-980401 experimental)] doesn't like it.
class C {};
typedef C A;
main()
{
A* p = new A;
p->~A();
}
Thanks,
Maurizio
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]