www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/06/03:38:48

X-Authentication-Warning: ieva01.lanet.lv: pavenis owned process doing -bs
Date: Tue, 6 Apr 1999 10:30:14 +0300 (WET)
From: Andris Pavenis <pavenis AT lanet DOT lv>
To: Andrew Reid <ac_reid AT hotmail DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: problem with new[] using djgpp egcs
In-Reply-To: <7e1h02$7nu$1@cantuc.canterbury.ac.nz>
Message-ID: <Pine.A41.4.05.9904061022560.35500-100000@ieva01.lanet.lv>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com


It is NOT DJGPP specific problem. The problem with upgradins to egcs is 
that some code recognized by earlier versions of gcc or egcs may no more
be recognized by newer versions mostly due to change of C++ standards and
more full implementation of them. You must be ready for such problems
(and more warnings) when upgrading. 

Anyway I cannot say whether such contruction is forbidden by current
standards or it is problem with latest versions of egcs. I think
correct address where to ask this is egcs mailing list
(egcs AT egcs DOT cygnus DOT com)

At least I'm getting the same message in Linux with egcs-1.1.2.

Andris


On Fri, 2 Apr 1999, Andrew Reid wrote:

> I'm having a problem with the standard new[] operator
> 
> The following code (a simple example) compiles and works fine with the
> djgpp(2.02) port of gcc 2.81, and with egcs under Redhat Linux 5.2, but
> causes an error when I try to use egcs 1.1.2 for djgpp or pgcc for linux
> 
> int main( void ) {
>  int* x = new int[5](0);
> }
> 
> The error message I get is:
> request for member `__ct' in `*{anon}', which is of non-aggregate type `int'
> and obviously the compiler is going to get stuck if it's trying to find
> members of a built in type
> 
> What is also interesting is the fact that compiling the statement T* x = new
> T[n]( const T& ) never causes any problems unless T is a builtin type.
> 
> My application of this code is in a template class where not all the types
> that the template is instantiated for have a default constructor, so I need
> to provide a default object of type T to the new operator.
> 
> I have a number of questions:
> Does anyone know why this won't compile under egcs for djgpp while gcc
> appears to be happy?
> Am I using the wrong libraries or headers? or perhaps I need a different
> version of the compiler?
> Is this standard c++?  If it isn't, then how should I tackle my problem in a
> standard compatible manner?
> 
> Thanks heaps - any help will be much appreciated
> 
> 
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019