* [Bug c++/31780] [4.3 regression] ICE with incompatible types for ?:
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
@ 2007-05-01 23:51 ` reichelt at gcc dot gnu dot org
2007-05-02 0:46 ` [Bug c++/31780] [4.3 regression] ICE with incompatible types for ?: with "complex type" conversion pinskia at gcc dot gnu dot org
` (43 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-05-01 23:51 UTC (permalink / raw)
To: gcc-bugs
--
reichelt at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
2007-05-01 23:51 ` [Bug c++/31780] " reichelt at gcc dot gnu dot org
@ 2007-05-02 0:46 ` pinskia at gcc dot gnu dot org
2007-05-02 0:47 ` pinskia at gcc dot gnu dot org
` (42 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-02 0:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-05-02 01:46 -------
> bug.cc:5: error: could not convert '0' to 'int __complex__'
Actually it should be able to convert that and I think this is the same reason
why we are rejecting PR 30209.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Keywords|error-recovery, ice-on- |ice-on-valid-code
|invalid-code |
Summary|[4.3 regression] ICE with |[4.3 regression] ICE with
|incompatible types for ?: |incompatible types for ?:
| |with "complex type"
| |conversion
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
2007-05-01 23:51 ` [Bug c++/31780] " reichelt at gcc dot gnu dot org
2007-05-02 0:46 ` [Bug c++/31780] [4.3 regression] ICE with incompatible types for ?: with "complex type" conversion pinskia at gcc dot gnu dot org
@ 2007-05-02 0:47 ` pinskia at gcc dot gnu dot org
2007-06-29 18:28 ` mmitchel at gcc dot gnu dot org
` (41 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-02 0:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-05-02 01:47 -------
Also I think this was caused by PR 31338.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |30209
OtherBugsDependingO| |31338
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-05-02 0:47 ` pinskia at gcc dot gnu dot org
@ 2007-06-29 18:28 ` mmitchel at gcc dot gnu dot org
2007-07-07 10:47 ` [Bug c++/31780] [4.2/4.3 " reichelt at gcc dot gnu dot org
` (40 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-06-29 18:28 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-06-29 18:28 ` mmitchel at gcc dot gnu dot org
@ 2007-07-07 10:47 ` reichelt at gcc dot gnu dot org
2007-07-07 19:26 ` mmitchel at gcc dot gnu dot org
` (39 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-07-07 10:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from reichelt at gcc dot gnu dot org 2007-07-07 10:47 -------
The ICE is now also present on the 4.2 branch.
Most likely caused by the patch for PR 31338.
--
reichelt at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at codesourcery dot com
Summary|[4.3 regression] ICE with |[4.2/4.3 regression] ICE
|incompatible types for ?: |with incompatible types for
|with "complex type" |?: with "complex type"
|conversion |conversion
Target Milestone|4.3.0 |4.2.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-07-07 10:47 ` [Bug c++/31780] [4.2/4.3 " reichelt at gcc dot gnu dot org
@ 2007-07-07 19:26 ` mmitchel at gcc dot gnu dot org
2007-07-07 19:35 ` mmitchel at gcc dot gnu dot org
` (38 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-07 19:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from mmitchel at gcc dot gnu dot org 2007-07-07 19:26 -------
The ICE is occurring in the gimplifier; it appears not to handle expressions
with type error_mark_node. Either we should not gimplify anything after an
error occurs, or it must be made more robust.
I'm thinking about whether or not the error itself is valid.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mmitchel at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-07-07 19:26:39
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-07-07 19:26 ` mmitchel at gcc dot gnu dot org
@ 2007-07-07 19:35 ` mmitchel at gcc dot gnu dot org
2007-07-07 22:13 ` mmitchel at gcc dot gnu dot org
` (37 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-07 19:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from mmitchel at gcc dot gnu dot org 2007-07-07 19:35 -------
I do think that the error is bogus.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-07-07 19:35 ` mmitchel at gcc dot gnu dot org
@ 2007-07-07 22:13 ` mmitchel at gcc dot gnu dot org
2007-07-07 22:21 ` mmitchel at gcc dot gnu dot org
` (36 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-07 22:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from mmitchel at gcc dot gnu dot org 2007-07-07 22:12 -------
Created an attachment (id=13867)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13867&action=view)
Patch
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-07-07 22:13 ` mmitchel at gcc dot gnu dot org
@ 2007-07-07 22:21 ` mmitchel at gcc dot gnu dot org
2007-07-07 22:44 ` pcarlini at suse dot de
` (35 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-07 22:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from mmitchel at gcc dot gnu dot org 2007-07-07 22:21 -------
I've attached a patch which fixes this bug in an obvious way.
Since complex types are arithmetic types in GNU C++, we should allow standard
conversions to them from integers, just as we do for all other arithmetic
types.
However, this runs into problems with libstdc++. In particular,
std::complex<double> has a constructor from double and also a constructor from
__complex__ double. Making the change in this patch makes that conversion
ambiguous because now "std::complex<double>(1)" can go via either the
"__complex__ double" constructor or the plain "double" constructor.
I'm pretty sure that we did indeed discuss this at some point in the past,
although I couldn't find a link and I don't remember what we decided, if
anything.
The easiest way to fix this is probably to add more constructors to
std::complex<double> to match all of the arithmetic types directly, e.g., add
"std::complex<double>::complex(int, int = 0)". Then, that will be the best
match.
I think we need input from the libstdc++ maintainers before trying to do
anything in the front end. Paolo?
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pcarlini at suse dot de
Status|ASSIGNED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (8 preceding siblings ...)
2007-07-07 22:21 ` mmitchel at gcc dot gnu dot org
@ 2007-07-07 22:44 ` pcarlini at suse dot de
2007-07-07 22:51 ` mark at codesourcery dot com
` (34 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: pcarlini at suse dot de @ 2007-07-07 22:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pcarlini at suse dot de 2007-07-07 22:44 -------
Hi Mark. First, I can point you to C++/21210. In that occasion (see in
particular Comment #3) we struggled with the issue quite a bit (if I remember
correctly we tried to avoid adding constructors...) then you came up with a
"magic" very simple solution! While I study a bit more the present issue maybe
you can re-focus that old one... (thanks for involving libstdc++ this time too)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (9 preceding siblings ...)
2007-07-07 22:44 ` pcarlini at suse dot de
@ 2007-07-07 22:51 ` mark at codesourcery dot com
2007-07-07 22:57 ` pcarlini at suse dot de
` (33 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2007-07-07 22:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from mark at codesourcery dot com 2007-07-07 22:51 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
pcarlini at suse dot de wrote:
> ------- Comment #8 from pcarlini at suse dot de 2007-07-07 22:44 -------
> Hi Mark. First, I can point you to C++/21210. In that occasion (see in
> particular Comment #3) we struggled with the issue quite a bit (if I remember
> correctly we tried to avoid adding constructors...) then you came up with a
> "magic" very simple solution! While I study a bit more the present issue maybe
> you can re-focus that old one... (thanks for involving libstdc++ this time too)
Ah, thanks for finding the old PR. In looking at the mail threads, I
fail to find my magic solution. :-( Do you have a pointer to it?
Thanks,
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (10 preceding siblings ...)
2007-07-07 22:51 ` mark at codesourcery dot com
@ 2007-07-07 22:57 ` pcarlini at suse dot de
2007-07-08 18:12 ` mark at codesourcery dot com
` (32 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: pcarlini at suse dot de @ 2007-07-07 22:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pcarlini at suse dot de 2007-07-07 22:57 -------
(In reply to comment #9)
> Ah, thanks for finding the old PR. In looking at the mail threads, I
> fail to find my magic solution. :-( Do you have a pointer to it?
Well, that PR is *closed as fixed*. Maybe at the time I didn't follow all the
details and your eventual fix was only partial, in some sense? Certainly 21210
is closed as fixed and we didn't add any constructor, contrary to some ideas
temporarily envisaged in the discussion linked in Comment #3 therein.
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn|21210 |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (11 preceding siblings ...)
2007-07-07 22:57 ` pcarlini at suse dot de
@ 2007-07-08 18:12 ` mark at codesourcery dot com
2007-07-08 18:42 ` pcarlini at suse dot de
` (31 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2007-07-08 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from mark at codesourcery dot com 2007-07-08 18:12 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
pcarlini at suse dot de wrote:
> ------- Comment #10 from pcarlini at suse dot de 2007-07-07 22:57 -------
> (In reply to comment #9)
>> Ah, thanks for finding the old PR. In looking at the mail threads, I
>> fail to find my magic solution. :-( Do you have a pointer to it?
>
> Well, that PR is *closed as fixed*. Maybe at the time I didn't follow all the
> details and your eventual fix was only partial, in some sense? Certainly 21210
> is closed as fixed and we didn't add any constructor, contrary to some ideas
> temporarily envisaged in the discussion linked in Comment #3 therein.
I was confused by your crediting me with magic because it was Roger
Sayle who fixed the bug. In any case, his fix was a specific hack for
converting zero to a complex type, not for the more general problem,
which has always remained unfixed.
I still think adding a few constructors is the best fix. The only
situation where we have a problem is a class with constructors taking
both a type like "double" and a GNU __complex__ type. GNU
__complex__types are very rare in C++ programs; people use std::complex
in C++, and there is no problem in that situation. :-)
So, libstdc++ is the rare case. Changing the library will give us very
natural semantics in the front end; we just declare GNU __complex__ to
be an arithmetic type, and everything else follows. Absent direction
from the ISO C++ committee regarding integration of C99 complex into
C++, that seems like the best we can do.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (12 preceding siblings ...)
2007-07-08 18:12 ` mark at codesourcery dot com
@ 2007-07-08 18:42 ` pcarlini at suse dot de
2007-07-08 18:58 ` mmitchel at gcc dot gnu dot org
` (30 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: pcarlini at suse dot de @ 2007-07-08 18:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from pcarlini at suse dot de 2007-07-08 18:42 -------
(In reply to comment #11)
> I was confused by your crediting me with magic because it was Roger
> Sayle who fixed the bug.
Ah! Curious, he doesn't work on the C++ front-end very often...
> So, libstdc++ is the rare case. Changing the library will give us very
> natural semantics in the front end; we just declare GNU __complex__ to
> be an arithmetic type, and everything else follows. Absent direction
> from the ISO C++ committee regarding integration of C99 complex into
> C++, that seems like the best we can do.
What can I say... Gaby designed the complex class that way, those special
constructors included. If we cannot avoid adding more constructors, so be it,
but of course please make sure Gaby agrees.
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Last reconfirmed|2007-07-07 19:26:39 |2007-07-08 18:42:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (13 preceding siblings ...)
2007-07-08 18:42 ` pcarlini at suse dot de
@ 2007-07-08 18:58 ` mmitchel at gcc dot gnu dot org
2007-07-20 3:49 ` mmitchel at gcc dot gnu dot org
` (29 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-08 18:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from mmitchel at gcc dot gnu dot org 2007-07-08 18:58 -------
Gaby --
Paolo and I would like your input on this issue, please.
Thanks,
-- Mark
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr at integrable-solutions
| |dot net
Status|NEW |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (14 preceding siblings ...)
2007-07-08 18:58 ` mmitchel at gcc dot gnu dot org
@ 2007-07-20 3:49 ` mmitchel at gcc dot gnu dot org
2007-10-09 19:22 ` mmitchel at gcc dot gnu dot org
` (28 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-20 3:49 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.1 |4.2.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (15 preceding siblings ...)
2007-07-20 3:49 ` mmitchel at gcc dot gnu dot org
@ 2007-10-09 19:22 ` mmitchel at gcc dot gnu dot org
2007-12-16 23:26 ` steven at gcc dot gnu dot org
` (27 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-10-09 19:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from mmitchel at gcc dot gnu dot org 2007-10-09 19:20 -------
Change target milestone to 4.2.3, as 4.2.2 has been released.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.2 |4.2.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (16 preceding siblings ...)
2007-10-09 19:22 ` mmitchel at gcc dot gnu dot org
@ 2007-12-16 23:26 ` steven at gcc dot gnu dot org
2007-12-18 5:36 ` mmitchel at gcc dot gnu dot org
` (26 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-12-16 23:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from steven at gcc dot gnu dot org 2007-12-16 23:26 -------
P1 regression and >2.5 months without activity.
PING!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (17 preceding siblings ...)
2007-12-16 23:26 ` steven at gcc dot gnu dot org
@ 2007-12-18 5:36 ` mmitchel at gcc dot gnu dot org
2007-12-23 21:22 ` gdr at gcc dot gnu dot org
` (25 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-12-18 5:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from mmitchel at gcc dot gnu dot org 2007-12-18 05:36 -------
We need input from a libstdc++ maintainer. Gaby was invited to comment, but
there's no comment from him in this PR. Paolo, do you have any further
thoughts?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (18 preceding siblings ...)
2007-12-18 5:36 ` mmitchel at gcc dot gnu dot org
@ 2007-12-23 21:22 ` gdr at gcc dot gnu dot org
2007-12-26 21:19 ` mark at codesourcery dot com
` (24 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-12-23 21:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #17 from gdr at gcc dot gnu dot org 2007-12-23 21:22 -------
(In reply to comment #13)
> Gaby --
>
> Paolo and I would like your input on this issue, please.
>
> Thanks,
>
> -- Mark
>
Sorry for replying late -- this issue escaped by attention; Paolo
kindly sent me a private reminder.
The std::complex<double> constructor taking a __complex__ double exists
primarily so that we can have a simple implementation of std::complex<double>
that is both compatible with C99 _Complex and the GNU extension __complex__,
and beneficiary of the existing machinery supporting that datatype.
I believe that is a plus we all agree we should keep.
I'm very nervous about adding more constructors.
I'd rather distinguish the constructor taking __complex__ by adding
a dummy parameter:
enum _DummyArg { };
complex(__complex__ double __z, _DummyArg);
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (19 preceding siblings ...)
2007-12-23 21:22 ` gdr at gcc dot gnu dot org
@ 2007-12-26 21:19 ` mark at codesourcery dot com
2007-12-26 22:03 ` pcarlini at suse dot de
` (23 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2007-12-26 21:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #18 from mark at codesourcery dot com 2007-12-26 21:19 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
gdr at gcc dot gnu dot org wrote:
> I'm very nervous about adding more constructors.
> I'd rather distinguish the constructor taking __complex__ by adding
> a dummy parameter:
>
> enum _DummyArg { };
> complex(__complex__ double __z, _DummyArg);
That will, however, break backwards compatibility for user programs (if
any) relying on the constructor.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (20 preceding siblings ...)
2007-12-26 21:19 ` mark at codesourcery dot com
@ 2007-12-26 22:03 ` pcarlini at suse dot de
2008-01-05 8:13 ` gdr at cs dot tamu dot edu
` (22 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: pcarlini at suse dot de @ 2007-12-26 22:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #19 from pcarlini at suse dot de 2007-12-26 22:02 -------
Also, I'm afraid the implementation of parts of <complex> (the transcendental
functions) may become much uglier, humpf...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (21 preceding siblings ...)
2007-12-26 22:03 ` pcarlini at suse dot de
@ 2008-01-05 8:13 ` gdr at cs dot tamu dot edu
2008-01-05 9:25 ` gdr at cs dot tamu dot edu
` (21 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-05 8:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #20 from gdr at cs dot tamu dot edu 2008-01-05 07:51 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Comment #18 from mark at codesourcery dot com 2007-12-26 21:19
-------
| Subject: Re: [4.2/4.3 regression] ICE with incompatible types
| for ?: with "complex type" conversion
|
| gdr at gcc dot gnu dot org wrote:
|
| > I'm very nervous about adding more constructors.
| > I'd rather distinguish the constructor taking __complex__ by adding
| > a dummy parameter:
| >
| > enum _DummyArg { };
| > complex(__complex__ double __z, _DummyArg);
|
| That will, however, break backwards compatibility for user programs (if
| any) relying on the constructor.
That isn't a concern because I never published that constructor as a
contract in the interface of std::complex<double>.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (22 preceding siblings ...)
2008-01-05 8:13 ` gdr at cs dot tamu dot edu
@ 2008-01-05 9:25 ` gdr at cs dot tamu dot edu
2008-01-05 9:32 ` mark at codesourcery dot com
` (20 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-05 9:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #21 from gdr at cs dot tamu dot edu 2008-01-05 07:51 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:
| Also, I'm afraid the implementation of parts of <complex> (the transcendental
| functions) may become much uglier, humpf...
I'm not sure what you mean; please could you clarify?
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (23 preceding siblings ...)
2008-01-05 9:25 ` gdr at cs dot tamu dot edu
@ 2008-01-05 9:32 ` mark at codesourcery dot com
2008-01-06 17:03 ` gdr at cs dot tamu dot edu
` (19 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2008-01-05 9:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #22 from mark at codesourcery dot com 2008-01-05 07:55 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
gdr at cs dot tamu dot edu wrote:
> | > I'd rather distinguish the constructor taking __complex__ by adding
> | > a dummy parameter:
> | >
> | > enum _DummyArg { };
> | > complex(__complex__ double __z, _DummyArg);
> |
> | That will, however, break backwards compatibility for user programs (if
> | any) relying on the constructor.
>
> That isn't a concern because I never published that constructor as a
> contract in the interface of std::complex<double>.
I'm not sure what you mean by that. It's a public constructor; how do
we know that there aren't users out there using it? How would they have
known that they weren't supposed to use it?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (24 preceding siblings ...)
2008-01-05 9:32 ` mark at codesourcery dot com
@ 2008-01-06 17:03 ` gdr at cs dot tamu dot edu
2008-01-06 21:45 ` mark at codesourcery dot com
` (18 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-06 17:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #23 from gdr at cs dot tamu dot edu 2008-01-06 15:28 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| Subject: Re: [4.2/4.3 regression] ICE with incompatible types
| for ?: with "complex type" conversion
|
| gdr at cs dot tamu dot edu wrote:
|
| > | > I'd rather distinguish the constructor taking __complex__ by adding
| > | > a dummy parameter:
| > | >
| > | > enum _DummyArg { };
| > | > complex(__complex__ double __z, _DummyArg);
| > |
| > | That will, however, break backwards compatibility for user programs (if
| > | any) relying on the constructor.
| >
| > That isn't a concern because I never published that constructor as a
| > contract in the interface of std::complex<double>.
|
| I'm not sure what you mean by that. It's a public constructor;
I mean that it is not a standard constructor, and it is not a
constructor I documented as a GNU extension. The fact that it is a
public constructor is not, by itself, a documentation that it is a
standard constructor or a constructor that users should use.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (25 preceding siblings ...)
2008-01-06 17:03 ` gdr at cs dot tamu dot edu
@ 2008-01-06 21:45 ` mark at codesourcery dot com
2008-01-07 1:44 ` gdr at cs dot tamu dot edu
` (17 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2008-01-06 21:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #24 from mark at codesourcery dot com 2008-01-06 21:06 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
gdr at cs dot tamu dot edu wrote:
> | I'm not sure what you mean by that. It's a public constructor;
>
> I mean that it is not a standard constructor, and it is not a
> constructor I documented as a GNU extension. The fact that it is a
> public constructor is not, by itself, a documentation that it is a
> standard constructor or a constructor that users should use.
But, it's also not documentation that users should *not* use it. And,
now it's been out there for a long time, so it's quite likely that some
users somewhere *are* using it. The run-time library has various
extensions to the standard, and the way people use a run-time library is
partly to open its header files and use what they see. I think we have
to accept that this is indeed an incompatible change and likely to
affect users.
That said, I do think it's reasonable to break backwards compatibility
here if we have no other choice. Right now, we have this odd wart in
the language with our handling of __complex__ (treating is as a
non-artithmetic type) which causes other problems. So, it's possible
that we have to choose between making an incompatible change to the
library and leaving the language wart -- and I think we're all agreed
that in that case we'd rather add the dummy parameter you suggest.
But, you've not shown that my suggestion of adding additional
constructors is detectable by users. If it's not, then that would be a
better solution: it would allow us to avoid the incompatible change to
the library. Of course, if adding constructors itself breaks
compatibility, then that's a powerful argument against my suggestion.
So far, all you've said is that it makes you nervous. Does it actually
break something?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (26 preceding siblings ...)
2008-01-06 21:45 ` mark at codesourcery dot com
@ 2008-01-07 1:44 ` gdr at cs dot tamu dot edu
2008-01-07 1:47 ` mark at codesourcery dot com
` (16 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-07 1:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #25 from gdr at cs dot tamu dot edu 2008-01-07 00:38 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| Subject: Re: [4.2/4.3 regression] ICE with incompatible types
| for ?: with "complex type" conversion
|
| gdr at cs dot tamu dot edu wrote:
|
| > | I'm not sure what you mean by that. It's a public constructor;
| >
| > I mean that it is not a standard constructor, and it is not a
| > constructor I documented as a GNU extension. The fact that it is a
| > public constructor is not, by itself, a documentation that it is a
| > standard constructor or a constructor that users should use.
|
| But, it's also not documentation that users should *not* use it. And,
| now it's been out there for a long time, so it's quite likely that some
| users somewhere *are* using it.
I would not bet money that nobody is not using it. However, that
somebody is using something specifically non-standard and NOT
documented GNU extension.
This situatiation is radically very different from the one where the
constructor would have been documented as GNU extension -- then we
would be stuck with it, and I would have been pressed hard to suggest
what I'm suggesting.
[...]
| But, you've not shown that my suggestion of adding additional
| constructors is detectable by users.
It is adding more constructors where the standard says none existed.
We have no plan of how those new constructors will interact with
future new additions. Consequently, I'm very reluctant adding those
constructors -- after all, these new single-parameter constructors are
being suggested because of an ambiguity caused by adding a single-parameter
constructor that did not exist (in the Standard) in the first place. I
would not like to continue that road by adding more, just to fix a mess
caused by this constructor and the compiler's handling of __complex__.
This isn't a case where I'm ready to say `the more the merrier' :-)
Adding an additional dummy parameter to the constructor __complex__
significantly reduces (to zero), the risk of conflict with anything
unforseen now. I believe that is what we should do.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (27 preceding siblings ...)
2008-01-07 1:44 ` gdr at cs dot tamu dot edu
@ 2008-01-07 1:47 ` mark at codesourcery dot com
2008-01-07 7:49 ` gdr at cs dot tamu dot edu
` (15 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2008-01-07 1:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #26 from mark at codesourcery dot com 2008-01-07 01:16 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
gdr at cs dot tamu dot edu wrote:
> I would not bet money that nobody is not using it. However, that
> somebody is using something specifically non-standard and NOT
> documented GNU extension.
>
> This situatiation is radically very different from the one where the
> constructor would have been documented as GNU extension
It isn't different to the user. This isn't quite the same situation as
fixing an accepts-invalid bug in the front end. There, a user had no
reason at all to expect the code to be valid, and the only way to make
the compiler conform to the requirement to emit a diagnostic is to
reject the code -- or at least give a warning about it. And I'd prefer
to warn rather than error where practical.
Imagine that you're a user. You read about GNU __complex__ types in the
manual. You write some code with them. Then, you want to call some C++
functions that expect std::complex. You look at the libstdc++ source
code, notice a constructor there that does what you want, and use it.
You upgrade to a new version of G++ and your code breaks. I'm sure you
agree that this doesn't make you happy.
So, let's not try to argue that changing the constructor signature is
painless. Instead, let's decide whether that's a better or worse
solution than adding more constructors. As I said previously, if adding
more constructors is going to break something, then I agree that it's bad.
> We have no plan of how those new constructors will interact with
> future new additions. Consequently, I'm very reluctant adding those
> constructors -- after all, these new single-parameter constructors are
> being suggested because of an ambiguity caused by adding a single-parameter
> constructor that did not exist (in the Standard) in the first place.
I don't understand this argument. Do you mean a future addition to the
ISO C++ standard or to the GNU C++ library? We control the latter, so
that doesn't seem like a problem.
Is it conceivable that ISO C++ will ever add a
complex<double>::complex(int) constructor that doesn't set the real part
to the value of the argument (converted to double), and the imaginary
part to zero? I'm not involved in the standards process at this point,
but that would be amazing to me, both since that would change the
meaning of:
complex<double>(3)
and since it would not conform to the usual mathematical notions of
projections of integers onto the complex plane.
What is the concern that you have?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (28 preceding siblings ...)
2008-01-07 1:47 ` mark at codesourcery dot com
@ 2008-01-07 7:49 ` gdr at cs dot tamu dot edu
2008-01-07 7:49 ` gdr at cs dot tamu dot edu
` (14 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-07 7:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #27 from gdr at cs dot tamu dot edu 2008-01-07 06:54 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Comment #26 from mark at codesourcery dot com 2008-01-07 01:16
-------
| Subject: Re: [4.2/4.3 regression] ICE with incompatible types
| for ?: with "complex type" conversion
|
| gdr at cs dot tamu dot edu wrote:
|
| > I would not bet money that nobody is not using it. However, that
| > somebody is using something specifically non-standard and NOT
| > documented GNU extension.
| >
| > This situatiation is radically very different from the one where the
| > constructor would have been documented as GNU extension
|
| It isn't different to the user.
Surely it is. If it a documented GNU extension, then it is a promise we
must keep. If it a standard constructor, then we don't have the choice.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (29 preceding siblings ...)
2008-01-07 7:49 ` gdr at cs dot tamu dot edu
@ 2008-01-07 7:49 ` gdr at cs dot tamu dot edu
2008-01-07 7:49 ` gdr at cs dot tamu dot edu
` (13 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-07 7:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #28 from gdr at cs dot tamu dot edu 2008-01-07 06:57 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| Imagine that you're a user. You read about GNU __complex__ types in the
| manual. You write some code with them. Then, you want to call some C++
| functions that expect std::complex. You look at the libstdc++ source
| code, notice a constructor there that does what you want, and use it.
| You upgrade to a new version of G++ and your code breaks. I'm sure you
| agree that this doesn't make you happy.
But, as that hypothetical user, I would not have any ground to be unhappy.
After all, it was code based on unfounded extrapolations.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (30 preceding siblings ...)
2008-01-07 7:49 ` gdr at cs dot tamu dot edu
@ 2008-01-07 7:49 ` gdr at cs dot tamu dot edu
2008-01-07 8:01 ` mark at codesourcery dot com
` (12 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-07 7:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #29 from gdr at cs dot tamu dot edu 2008-01-07 07:09 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| > We have no plan of how those new constructors will interact with
| > future new additions. Consequently, I'm very reluctant adding those
| > constructors -- after all, these new single-parameter constructors are
| > being suggested because of an ambiguity caused by adding a single-parameter
| > constructor that did not exist (in the Standard) in the first place.
|
| I don't understand this argument. Do you mean a future addition to the
| ISO C++ standard or to the GNU C++ library?
ISO C++.
| Is it conceivable that ISO C++ will ever add a
| complex<double>::complex(int) constructor that doesn't set the real part
| to the value of the argument (converted to double), and the imaginary
| part to zero?
That isn't the issue. My concern is whether ISO C++ will ever
change conversion rules, say from integers to floats or doubles. The
answer is likely.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (31 preceding siblings ...)
2008-01-07 7:49 ` gdr at cs dot tamu dot edu
@ 2008-01-07 8:01 ` mark at codesourcery dot com
2008-01-07 8:16 ` mark at codesourcery dot com
` (11 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2008-01-07 8:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #30 from mark at codesourcery dot com 2008-01-07 07:44 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
gdr at cs dot tamu dot edu wrote:
> | Is it conceivable that ISO C++ will ever add a
> | complex<double>::complex(int) constructor that doesn't set the real part
> | to the value of the argument (converted to double), and the imaginary
> | part to zero?
>
> That isn't the issue. My concern is whether ISO C++ will ever
> change conversion rules, say from integers to floats or doubles. The
> answer is likely.
What's the likely change?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (32 preceding siblings ...)
2008-01-07 8:01 ` mark at codesourcery dot com
@ 2008-01-07 8:16 ` mark at codesourcery dot com
2008-01-07 9:48 ` gdr at cs dot tamu dot edu
` (10 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2008-01-07 8:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #31 from mark at codesourcery dot com 2008-01-07 07:48 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
gdr at cs dot tamu dot edu wrote:
> But, as that hypothetical user, I would not have any ground to be unhappy.
> After all, it was code based on unfounded extrapolations.
I think this is a mistake. Our documentation has never been good
enough for people to rely on the absence of documentation as meaningful.
One of the most frequent complaints I get about GCC is that we break
existing code with every release. Apparently, we do this much more
often than other other compilers.
You're clearly not going to agree with me. So be it.
Please ask your fellow libstdc++ maintainers what they think.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (33 preceding siblings ...)
2008-01-07 8:16 ` mark at codesourcery dot com
@ 2008-01-07 9:48 ` gdr at cs dot tamu dot edu
2008-01-07 9:48 ` gdr at cs dot tamu dot edu
` (9 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-07 9:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #32 from gdr at cs dot tamu dot edu 2008-01-07 08:00 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Comment #31 from mark at codesourcery dot com 2008-01-07 07:48
-------
| Subject: Re: [4.2/4.3 regression] ICE with incompatible types
| for ?: with "complex type" conversion
|
| gdr at cs dot tamu dot edu wrote:
|
| > But, as that hypothetical user, I would not have any ground to be unhappy.
| > After all, it was code based on unfounded extrapolations.
|
| I think this is a mistake.
The real mistake was when I make that constructor unary. It was a
terrible mistake. And I apologize for that.
The fix isn't to build more brittle tower on top of it in the name of
hypothetical codes written with unfounded assumptions.
[...]
| One of the most frequent complaints I get about GCC is that we break
| existing code with every release.
I get that complain too. But only for documented features.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (34 preceding siblings ...)
2008-01-07 9:48 ` gdr at cs dot tamu dot edu
@ 2008-01-07 9:48 ` gdr at cs dot tamu dot edu
2008-01-07 16:46 ` mark at codesourcery dot com
` (8 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-07 9:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #33 from gdr at cs dot tamu dot edu 2008-01-07 08:10 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| Subject: Re: [4.2/4.3 regression] ICE with incompatible types
| for ?: with "complex type" conversion
|
| gdr at cs dot tamu dot edu wrote:
|
| > | Is it conceivable that ISO C++ will ever add a
| > | complex<double>::complex(int) constructor that doesn't set the real part
| > | to the value of the argument (converted to double), and the imaginary
| > | part to zero?
| >
| > That isn't the issue. My concern is whether ISO C++ will ever
| > change conversion rules, say from integers to floats or doubles. The
| > answer is likely.
|
| What's the likely change?
Ban implicit narrowing conversions, in the sense that a round trip will not
give the same value back. The exact rules are in flux (there was a
specification discussed at the last Kona meeting, but it got changed
based on feedback, and may likely change from now to Sophia Antipolis
meeting). However, the general idea meets consensus.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (35 preceding siblings ...)
2008-01-07 9:48 ` gdr at cs dot tamu dot edu
@ 2008-01-07 16:46 ` mark at codesourcery dot com
2008-01-08 8:38 ` gdr at cs dot tamu dot edu
` (7 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2008-01-07 16:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #34 from mark at codesourcery dot com 2008-01-07 16:17 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
gdr at cs dot tamu dot edu wrote:
> | What's the likely change?
>
> Ban implicit narrowing conversions, in the sense that a round trip will not
> give the same value back.
Which direction is narrowing, between "int" and "float"? (Both have
values unrepresentable in the other, of course.) Would you please give
an example of how this change, together with the new constructors, would
make some program behave differently than the standard says it should?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (36 preceding siblings ...)
2008-01-07 16:46 ` mark at codesourcery dot com
@ 2008-01-08 8:38 ` gdr at cs dot tamu dot edu
2008-01-08 8:43 ` mark at codesourcery dot com
` (6 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-01-08 8:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #35 from gdr at cs dot tamu dot edu 2008-01-08 02:52 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types for ?: with
"complex type" conversion
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Comment #34 from mark at codesourcery dot com 2008-01-07 16:17
-------
| Subject: Re: [4.2/4.3 regression] ICE with incompatible types
| for ?: with "complex type" conversion
|
| gdr at cs dot tamu dot edu wrote:
|
| > | What's the likely change?
| >
| > Ban implicit narrowing conversions, in the sense that a round trip will not
| > give the same value back.
|
| Which direction is narrowing, between "int" and "float"?
The rule is not just based on 'type'; if the source value is a
constant, then the implementation determine whether a round trip is
OK. Otherwise, it uses 'just' the type rule (for safe approximation).
furthermore, based on feedback from Koan meeting, it is also
proposed that narrowing should not cross integer-float barrier.
| (Both have
| values unrepresentable in the other, of course.) Would you please give
| an example of how this change, together with the new constructors, would
| make some program behave differently than the standard says it should?
Please see the details in the proposal put foward by BS, me, and JSA titled
`initializer list' (post Toronto meeting), and the recent `rationale'
paper by BS in the mid-term mailing. Look for the section or word `narrowing'.
(I'm currently in a location in san francisco where the nhe flakky
network connection does not ease extended mail).
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (37 preceding siblings ...)
2008-01-08 8:38 ` gdr at cs dot tamu dot edu
@ 2008-01-08 8:43 ` mark at codesourcery dot com
2008-01-22 16:01 ` jason at gcc dot gnu dot org
` (5 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2008-01-08 8:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #36 from mark at codesourcery dot com 2008-01-08 03:39 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
gdr at cs dot tamu dot edu wrote:
> | (Both have
> | values unrepresentable in the other, of course.) Would you please give
> | an example of how this change, together with the new constructors, would
> | make some program behave differently than the standard says it should?
>
> Please see the details in the proposal put foward by BS, me, and JSA titled
> `initializer list' (post Toronto meeting), and the recent `rationale'
> paper by BS in the mid-term mailing. Look for the section or word `narrowing'.
I don't know where to find those things, unfortunately. Do you have a URL?
Would you please provide an example of how:
complex<float> {
Complex (int i) : real_(i) {};
Complex (float f): real_f() {};
float real_;
float imag_;
};
would be different than just:
complex<float> {
Complex (float f): real_f() {};
float real_;
float imag_;
};
when passed an "int"? I'm having a hard time seeing how making the
conversion in the constructor would be different than making it at the
call site, whether or not the argument is a constant.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (38 preceding siblings ...)
2008-01-08 8:43 ` mark at codesourcery dot com
@ 2008-01-22 16:01 ` jason at gcc dot gnu dot org
2008-01-22 18:05 ` mark at codesourcery dot com
` (4 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-01-22 16:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #37 from jason at gcc dot gnu dot org 2008-01-22 15:37 -------
(In reply to comment #7)
> Since complex types are arithmetic types in GNU C++, we should allow standard
> conversions to them from integers, just as we do for all other arithmetic
> types.
>
> However, this runs into problems with libstdc++. In particular,
> std::complex<double> has a constructor from double and also a constructor from
> __complex__ double. Making the change in this patch makes that conversion
> ambiguous because now "std::complex<double>(1)" can go via either the
> "__complex__ double" constructor or the plain "double" constructor.
It seems clear to me that conversion to complex should be worse than conversion
to another scalar arithmetic type. I would implement this in hypothetical
standardese by defining "complex conversions" for the conversion from scalar to
complex, and the term "scalar arithmetic conversions" for integer, float and
integer-float conversions, then adding to 13.3.3.2p3 an additional rule that S1
is better than S2 if S1 is a scalar arithmetic conversion and S2 is a complex
conversion.
I think this approach would avoid the need for extra constructors.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (39 preceding siblings ...)
2008-01-22 16:01 ` jason at gcc dot gnu dot org
@ 2008-01-22 18:05 ` mark at codesourcery dot com
2008-01-25 16:52 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: mark at codesourcery dot com @ 2008-01-22 18:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #38 from mark at codesourcery dot com 2008-01-22 17:47 -------
Subject: Re: [4.2/4.3 regression] ICE with incompatible types
for ?: with "complex type" conversion
jason at gcc dot gnu dot org wrote:
>> However, this runs into problems with libstdc++. In particular,
>> std::complex<double> has a constructor from double and also a constructor from
>> __complex__ double. Making the change in this patch makes that conversion
>> ambiguous because now "std::complex<double>(1)" can go via either the
>> "__complex__ double" constructor or the plain "double" constructor.
>
> It seems clear to me that conversion to complex should be worse than conversion
> to another scalar arithmetic type. I would implement this in hypothetical
> standardese by defining "complex conversions" for the conversion from scalar to
> complex, and the term "scalar arithmetic conversions" for integer, float and
> integer-float conversions, then adding to 13.3.3.2p3 an additional rule that S1
> is better than S2 if S1 is a scalar arithmetic conversion and S2 is a complex
> conversion.
Yes, that would probably work. I would prefer to avoid a whole new
class of conversions, and it doesn't seem necessary to me, since I still
don't understand what Gaby is worried about. But, it does seem like a
technically feasible solution if absolutely necessary.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (40 preceding siblings ...)
2008-01-22 18:05 ` mark at codesourcery dot com
@ 2008-01-25 16:52 ` rguenth at gcc dot gnu dot org
2008-01-25 18:54 ` jason at gcc dot gnu dot org
` (2 subsequent siblings)
44 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-25 16:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #39 from rguenth at gcc dot gnu dot org 2008-01-25 15:46 -------
Jason, can you coordinate with Mark and help with the remaining P1 C++
regressions?
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu dot org
Status|WAITING |NEW
Last reconfirmed|2007-07-08 18:42:04 |2008-01-25 15:46:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (41 preceding siblings ...)
2008-01-25 16:52 ` rguenth at gcc dot gnu dot org
@ 2008-01-25 18:54 ` jason at gcc dot gnu dot org
2008-01-25 20:14 ` jason at gcc dot gnu dot org
2008-01-25 20:17 ` [Bug c++/31780] [4.2 " jason at gcc dot gnu dot org
44 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-01-25 18:54 UTC (permalink / raw)
To: gcc-bugs
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|mmitchel at gcc dot gnu dot |jason at gcc dot gnu dot org
|org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (42 preceding siblings ...)
2008-01-25 18:54 ` jason at gcc dot gnu dot org
@ 2008-01-25 20:14 ` jason at gcc dot gnu dot org
2008-01-25 20:17 ` [Bug c++/31780] [4.2 " jason at gcc dot gnu dot org
44 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-01-25 20:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #40 from jason at gcc dot gnu dot org 2008-01-25 19:45 -------
Subject: Bug 31780
Author: jason
Date: Fri Jan 25 19:45:11 2008
New Revision: 131832
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131832
Log:
PR c++/31780
* call.c (standard_conversion): Allow conversion from integer/real
to complex.
(compare_ics): Such a conversion is worse than a normal arithmetic
conversion.
Added:
trunk/gcc/testsuite/g++.dg/ext/complex3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread
* [Bug c++/31780] [4.2 regression] ICE with incompatible types for ?: with "complex type" conversion
2007-05-01 23:50 [Bug c++/31780] New: [4.3 regression] ICE with incompatible types for ?: reichelt at gcc dot gnu dot org
` (43 preceding siblings ...)
2008-01-25 20:14 ` jason at gcc dot gnu dot org
@ 2008-01-25 20:17 ` jason at gcc dot gnu dot org
44 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-01-25 20:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #41 from jason at gcc dot gnu dot org 2008-01-25 19:51 -------
Fixed for 4.3.0, not worth fixing on 4.2 branch.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Summary|[4.2/4.3 regression] ICE |[4.2 regression] ICE with
|with incompatible types for |incompatible types for ?:
|?: with "complex type" |with "complex type"
|conversion |conversion
Target Milestone|4.2.3 |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31780
^ permalink raw reply [flat|nested] 46+ messages in thread