From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gabriel Dos Reis To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: c++/3827: new int problem. Date: Thu, 26 Jul 2001 00:26:00 -0000 Message-id: <20010726072600.14039.qmail@sourceware.cygnus.com> X-SW-Source: 2001-07/msg00702.html List-Id: The following reply was made to PR c++/3827; it has been noted by GNATS. From: Gabriel Dos Reis To: fasbjx@free.fr Cc: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org Subject: Re: c++/3827: new int problem. Date: 26 Jul 2001 09:16:52 +0200 fasbjx@libertysurf.fr, Branjonneau@free.fr writes: | template< typename T, int role, bool ndebug > | struct init { | static T * do_it() { | T* tmp(new T); | std::cout << "/tmp/ point to: " << *tmp << "\n"; | return tmp; | } | }; | /tmp/ point to: 0 | /tmp/ point to: 1075812784 Hi, This is not a bug in the compiler. For fundamental types, a direct-new-expression of the form 'new T' does -not- do default initialization. If you hve to say new T() to get default initialization. Please note the parens. -- Gaby CodeSourcery, LLC http://www.codesourcery.com