public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12491] New: Destructor fails to compile when optimizations (inlining) are enabled
@ 2003-10-02 11:36 harizak at speech dot gr
  2003-10-02 11:38 ` [Bug c++/12491] " harizak at speech dot gr
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: harizak at speech dot gr @ 2003-10-02 11:36 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Destructor fails to compile when optimizations
                    (inlining) are enabled
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: harizak at speech dot gr
                CC: gcc-bugs at gcc dot gnu dot org,harizak at speech dot gr
 GCC build triplet: i386-pc-solaris2.8
  GCC host triplet: i386-pc-solaris2.8
GCC target triplet: i386-pc-solaris2.8

Problem description
===================

  The compiler failes to compile the destructor of the Error class (see below)
when its body is outside of the class definition and inlining is turned on.
Moving the body within the Error class definition makes the error disappear. 

  Turning of inlining using the -fno-inline switch solves the problem. The
problem is also solved by disabling optimizations by using either -O0 or
omitting the -O2.

  Best regards,

  Costas

P.S. Keep up the great work.


System description
==================

  The g++ used is the 3.3.1 configured with the following command on a Intel
Solaris 2.8 system:

./configure --prefix=<pathname> --enable-threads --enable-languages=c,c++,java
--disable-nls

Thread model: posix


How to reproduce the error
==========================

  The example can be successfully compiled with:

g++ <filename> -c -O2 -fno-inline

  But fails when the following is used:

g++ <filename> -c -O2


Example file producing error (after dashed line)
================================================


---------------------------------------------------------------

class Object
{
public:
	virtual ~Object (void)
		{ return; }
};


class AutoPtr
{
public:
	~AutoPtr (void)
		{ delete m_rep; return; }

private:
        const Object*   m_rep;

};


class Handle
{
public:
	~Handle	(void)
		{ return; }

private:
	AutoPtr		m_rep;

};


class HandleOf : public Handle
{
public:
	~HandleOf (void)
		{ return; }
};


class Error
{
public:
	~Error (void);

private:
	HandleOf	m_hndl;
};


Error::~Error (void)
{
	return;
}


---------------------------------------------------------------


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2004-01-27 13:08 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-02 11:36 [Bug c++/12491] New: Destructor fails to compile when optimizations (inlining) are enabled harizak at speech dot gr
2003-10-02 11:38 ` [Bug c++/12491] " harizak at speech dot gr
2003-10-02 11:39 ` harizak at speech dot gr
2003-10-02 12:23 ` nathan at gcc dot gnu dot org
2003-10-02 12:28 ` harizak at speech dot gr
2003-10-02 15:36 ` [Bug optimization/12491] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2003-10-16  9:36 ` mmitchel at gcc dot gnu dot org
2003-10-26 21:48 ` [Bug optimization/12491] [3.3/3.4 Regression] [eh] " pinskia at gcc dot gnu dot org
2003-12-05 14:31 ` ebotcazou at gcc dot gnu dot org
2003-12-05 14:37 ` [Bug c++/12491] " ebotcazou at gcc dot gnu dot org
2003-12-06  1:09 ` wilson at specifixinc dot com
2003-12-06  9:18 ` ebotcazou at gcc dot gnu dot org
2003-12-06 21:12 ` bangerth at dealii dot org
2003-12-07 17:16 ` pinskia at gcc dot gnu dot org
2003-12-29 18:55 ` [Bug c++/12491] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2004-01-14  8:23 ` gdr at gcc dot gnu dot org
2004-01-14 10:32 ` rth at gcc dot gnu dot org
2004-01-14 21:01 ` cvs-commit at gcc dot gnu dot org
2004-01-14 21:04 ` rth at gcc dot gnu dot org
2004-01-14 22:07 ` pinskia at gcc dot gnu dot org
2004-01-27 13:08 ` cvs-commit at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).