From -4843421902568582240
X-Google-Thread: f78e5,51456c3eb8f9490e
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!newsgate.cistron.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: hofmann@anvil-soft.com ("Matthias Hofmann")
Newsgroups: comp.std.c++
Subject: Re: Copy Constructor Confusion!
Date: Tue, 22 Aug 2006 14:51:32 GMT
Lines: 43
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <4l0b4dFe1jfnU1@individual.net>
References: <1155645873.296811.3890@74g2000cwt.googlegroups.com>   <hPkEg.12700$j7.324766@news.indigo.ie>   <1155654560.689240.298360@i3g2000cwc.googlegroups.com>   <tRJEg.12743$j7.325006@news.indigo.ie>   <1155833485.406514.274480@i3g2000cwc.googlegroups.com>   <4kjormFcgsncU1@individual.net> <1156163006.926218.91070@i3g2000cwc.googlegroups.com>
NNTP-Posting-Host: news.news.demon.net
X-Trace: news.demon.co.uk 1156258306 26217 158.152.254.254 (22 Aug 2006 14:51:46 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 22 Aug 2006 14:51:46 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Priority: 3
X-Orig-X-Trace: individual.net tXVJ8uh1lbuu/2ABXR65/A3rqt+mtrCg3Ami4o1wlQmYvVJGJB
X-RFC2646: Format=Flowed; Original
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-MSMail-Priority: Normal
X-Originating-IP: 130.133.1.2
X-Received: (from fjh@localhost)
	by mulga.csse.unimelb.edu.au (8.13.6+Sun/8.13.6/Submit) id k7MEpXR6011735;
	Wed, 23 Aug 2006 00:51:33 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@mailman.ucar.edu
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-Newsgroups: comp.std.c++
Xref: g2news2.google.com comp.std.c++:3409

"kanze" <kanze@gabi-soft.fr> schrieb im Newsbeitrag 
news:1156163006.926218.91070@i3g2000cwc.googlegroups.com...

> Note that for a non-POD class type, the default constructor for
> T is called.  In the unlikely case that you define a
> user-defined destructor or a user-defined copy assignment
> operator, but no constructor, T() becomes once again a no-op (or
> rather, leaves the object in an undefined state).

I thought that a user-defined destructor would not have any influence on the 
implicit definition of a default constructor, but the following code does 
indeed output a random value:

struct X
{
    ~X() {}

    int i;
};

int main()
{
    cout << X().i << endl;

    return 0;
}

This puzzles me, as it does not seem to make any sense. Can you please show 
me the sections of the standard that require this behaviour?

-- 
Matthias Hofmann
Anvil-Soft, CEO
http://www.anvil-soft.com - The Creators of Toilet Tycoon
http://www.anvil-soft.de - Die Macher des Klomanagers


---
[ 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://www.comeaucomputing.com/csc/faq.html                      ]



