This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with PR 21210


Zack Weinberg <zack@codesourcery.com> writes:

| Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
| 
| > Zack Weinberg <zack@codesourcery.com> writes:
| >
| > | > This also depends on somebody not myself doing a not-insubstantial
| > | > amount of core compiler work to make it happen; and somebody else
| > | > jimmying the libstdc++ headers to match, presumably a lesser task.
| > | 
| > | I gotta wonder how much of the way there it would get us if we could
| > | write
| > | 
| > |   template <typename T> class complex;
| > |   template <>
| > |   typedef _Complex double complex<double>;
| >
| > If we do that, we mutate C++ because we would have now introduced an
| > implicit conversion of a std:complex<double> to its real part, where
| > it did not exist before.
| 
| Bother.

My earlier comment did not provide an example:

    void f(const complex<long double>&);  // #1
    void f(double);                       // #2

    int main() {
      std::complex<double> z;
      f(z);
    }

Currently, this will pick #1.  If we make _Complex double and
std::complex<double> identical, we silently break the program because 
now we would call #2 (for a standard conversion is better than
user-defined conversion). 

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]