From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10034 invoked by alias); 7 Jan 2008 01:16:48 -0000 Received: (qmail 9835 invoked by alias); 7 Jan 2008 01:16:03 -0000 Date: Mon, 07 Jan 2008 01:47:00 -0000 Message-ID: <20080107011603.9834.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/31780] [4.2/4.3 regression] ICE with incompatible types for ?: with "complex type" conversion In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mark at codesourcery dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg00576.txt.bz2 ------- 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::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(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