public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Alexander Zvyagin <Alexander.Zviagine@cern.ch>
To: gcc-gnats@gcc.gnu.org
Cc: Alexander Zvyagin <Alexander.Zviagine@cern.ch>
Subject: c++/6058: c++: object is not created
Date: Tue, 26 Mar 2002 02:46:00 -0000	[thread overview]
Message-ID: <200203261038.LAA08949@lxplus015.cern.ch> (raw)


>Number:         6058
>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 02:46:08 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 Category:   c++
 Ofriginator:     Alexander Zvyagin
 Organization:   LMU
 Synopsis:       an object of a C++ class is not created
 Severity:       serious
 Priority:   medium
 Class:      wrong-code
 Release:    3.0.4
 Environment: 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 three objects of the class TT. But only two objects
 are created (there are only two calls for constructor/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.
 
 How-To-Repeat:
 $ g++ constructors.cc
 $ ./a.out
>How-To-Repeat:
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-03-26 10:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-26  2:46 Alexander Zvyagin [this message]
2002-04-04  5:10 jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200203261038.LAA08949@lxplus015.cern.ch \
    --to=alexander.zviagine@cern.ch \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).