public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Is it a bug ?
       [not found] ` <orvhwzzkd1.fsf.cygnus.egcs.bugs@grupiara.dcc.unicamp.br>
@ 1997-12-08 22:22   ` Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 1997-12-08 22:22 UTC (permalink / raw)
  To: Alexandre Oliva, egcs

>>>>> Alexandre Oliva <oliva@dcc.unicamp.br> writes:

> knizhnik  writes:
>> It looks like bug in compiler (if class A has no constructor then
>> no error message is produced)

> That's because the implicit constructor defined for A won't ever
> throw, that is, it is declared as:

> A::A() throw() {}

More correctly, the implicit constructor is trivial, so it doesn't get
called at all.

> So no exception handling code is inserted there.  Declaring the
> constructor of A as such should help

g++ currently doesn't do any optimization based on throw specs.

> but I believe access control should not be performed at that point.  The
> Nov'97 is not clear about that.

I disagree.  [expr.new] just says that a deallocation function is called;
it gives no indication that this call would be any different from any other
call, so access control should be performed.

Jason

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

* Re: is it a bug?
  1998-04-30 10:25 is it a bug? JC Loredo-Osti
@ 1998-04-30 15:45 ` Joe Buck
  1998-04-30 13:20   ` JC Loredo-Osti
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Buck @ 1998-04-30 15:45 UTC (permalink / raw)
  To: JC Loredo-Osti; +Cc: egcs-bugs, egcs

> Both, egcs-19980418 and egcs-19980425, complain about the follwing code

> main(){
> 	double *p = new double[3](0);
> }

That's because it isn't C++.  g++ used to have an extension that allowed
the use of constructor arguments with arrays, but it hasn't been
maintained and the egcs team wants to encourage people to program in C++,
not a strange dialect called g++.  So you are likely to see the more
questionable GNU extensions eliminated.

If you need to do something like this (an array of values each of which
is initialized using constructor arguments), use vector<double> instead:

	vector<double> p(3,0.0);

(saying p(3,0) here will result in trouble -- yet another problem).

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

* Re: is it a bug?
  1998-04-30 15:45 ` Joe Buck
@ 1998-04-30 13:20   ` JC Loredo-Osti
  0 siblings, 0 replies; 4+ messages in thread
From: JC Loredo-Osti @ 1998-04-30 13:20 UTC (permalink / raw)
  To: Joe Buck; +Cc: egcs-bugs, egcs

> 
> > Both, egcs-19980418 and egcs-19980425, complain about the follwing code
> 
> > main(){
> > 	double *p = new double[3](0);
> > }
> 
> That's because it isn't C++.  g++ used to have an extension that allowed
> the use of constructor arguments with arrays, but it hasn't been
> maintained and the egcs team wants to encourage people to program in C++,
> not a strange dialect called g++.  So you are likely to see the more
> questionable GNU extensions eliminated.
> 
Yes, I have seen some of those. For this one I look into some books and I
didn't read nothing about it. 

Thanks a lot,
-j



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

* is it a bug?
@ 1998-04-30 10:25 JC Loredo-Osti
  1998-04-30 15:45 ` Joe Buck
  0 siblings, 1 reply; 4+ messages in thread
From: JC Loredo-Osti @ 1998-04-30 10:25 UTC (permalink / raw)
  To: egcs-bugs, egcs

Both, egcs-19980418 and egcs-19980425, complain about the follwing code



main(){
	double *p = new double[3](0);
}



However it does compile with egcs-1.0.2 and gcc-2.8.x
(With gcc-2.7.2 it gets a internal compiler error which is supresed by
replacing '(0)' with '(0.0)')

Is it a bug or new feature?

-j

josti@mscs.dal.ca


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

end of thread, other threads:[~1998-04-30 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199712081205.NAA25992@vbormc.vbo.dec.com>
     [not found] ` <orvhwzzkd1.fsf.cygnus.egcs.bugs@grupiara.dcc.unicamp.br>
1997-12-08 22:22   ` Is it a bug ? Jason Merrill
1998-04-30 10:25 is it a bug? JC Loredo-Osti
1998-04-30 15:45 ` Joe Buck
1998-04-30 13:20   ` JC Loredo-Osti

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