public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/6060: c++: object is not created
@ 2002-03-26  3:16 Alexander Zvyagin
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Zvyagin @ 2002-03-26  3:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6060
>Category:       c++
>Synopsis:       c++: object is not created
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 26 03:16:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        
>Organization:
>Environment:
System: Linux lxplus015 2.2.19-6.2.1.1smp #1 SMP Tue Apr 17 20:00:04 CEST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/afs/cern.ch/compass/delivery/tools/gcc-3.0.4
Description:
The code shown below should create four objects of the class TT. But only three objects
are created (there are only three calls for the constructors/destructor).

// File constructors.cc
#include <iostream>
using std::cout;

class TT
{
  public:
   ~TT (void   )          {cout << "D\n";}
    TT (void   ) : c(' ') {cout << "C\n";}
    TT (char cc) : c(cc ) {cout << "C " << c << "\n";}
    char c;
};

int main()
{
  cout << "1\n";
  TT();
  cout << "2\n";
  TT t2('a');
  cout << "3\n";
  TT t3();          // The object is not created!!!
  cout << "4\n";
  TT t4;            // OK!
  cout << "5\n";
}
// EOF

Output:
$ ./a.out
1
C
D
2
C a
3
4
C
5
D
D

So the object 't3' was not created.

>Description:
 Originator:	Alexander Zvyagin
 Organization:	LMU,CERN
 Synopsis:	T t();   object creation does not work
 Severity:	serious
 Priority:	medium
 Class:		wrong-code
 Release:	3.0.4
>How-To-Repeat:
$ g++ constructors.cc
$ ./a.out
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/6060: c++: object is not created
@ 2002-03-26  3:22 paolo
  0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2002-03-26  3:22 UTC (permalink / raw)
  To: Alexander.Zviagine, gcc-bugs, gcc-prs, nobody

Synopsis: c++: object is not created

State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Tue Mar 26 03:22:48 2002
State-Changed-Why:
    Duplicate of c++/6058.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6060


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

end of thread, other threads:[~2002-03-26 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-26  3:16 c++/6060: c++: object is not created Alexander Zvyagin
2002-03-26  3:22 paolo

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).