octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with changeset fa917f1f0faf


From: Carnë Draug
Subject: Re: problem with changeset fa917f1f0faf
Date: Thu, 11 Aug 2016 02:29:00 +0100

On 11 August 2016 at 01:51, Ben Abbott <address@hidden> wrote:
>> On Aug 10, 2016, at 8:37 PM, Carnë Draug <address@hidden> wrote:
>>
>> On 11 August 2016 at 00:47, Ben Abbott <address@hidden> wrote:
>>> Carne,
>>>
>>> I think I’m seeing an error associated with the change below.
>>>
>>>        http://hg.savannah.gnu.org/hgweb/octave/rev/fa917f1f0faf
>>>
>>> [...]
>>>
>>> liboctave/array/MatrixType.cc:530:23: error: assigning to 'double' from 
>>> incompatible type 'complex<double>'
>>>                    d = std::conj (d);
>>>                      ^ ~~~~~~~~~~~~~
>>
>> How does your compiler handles this?
>>
>>    #include <iostream>
>>    #include <complex>
>>    #include <typeinfo>
>>
>>    int main()
>>    {
>>      std::cout << typeid (std::conj (double (5.0))).name() << std::endl;
>>    }
>>
>> If you get back a complex number, the issue is discussed on DR 1137 [1].
>> You should get back d for double.  I only found this DR number because
>> it's refered on the GCC implementation of conj.
>>
>> Carnë
>>
>> [1] https://lwg.github.io/issues/lwg-defects.html#1137
>
> I’m out of my element … I placed those lines in foo.cc and compiled using 
> Apple’s clang
>

This is what I get:

    $ cat foo.cc
    #include <iostream>
    #include <complex>
    #include <typeinfo>
    int main()
    {
      std::cout << typeid (std::conj (double (5.0))).name() << std::endl;
    }
    $ g++ --std=c++11 foo.cc -o foo
    $ ./foo
    d

On 11 August 2016 at 02:07, Mike Miller <address@hidden> wrote:
> [...]
> I took the liberty of testing with clang 3.8 on Debian.
>
> With clang and llvm libc++, I get similar errors about streams and 
> char_traits.
>
> With clang and gcc libstdc++, I get the following:
>
>   address@hidden:~/src$ clang-3.8 -o foo foo.cc
>   foo.cc:7:24: error: no matching function for call to 'conj'
>     std::cout << typeid (std::conj (double (5.0))).name() << std::endl;
>                          ^~~~~~~~~
>   
> /usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/c++/6.1.1/complex:677:5:
>  note: candidate template ignored: could not match 
> 'complex<type-parameter-0-0>' against 'double'
>       conj(const complex<_Tp>& __z)
>       ^
>   1 error generated.

I think this is the issue and it should be resolving to something like this

  
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/complex#L1930

I will guess that replacing std::conj with octave::numeric::conj will also
trigger this issue.  Octave's conj() is now just imported from std [2].
If my guess is right, then I guess this means that octave::numeric::conj
is never used in Octave for real types.

Carnë

[2] 
http://hg.savannah.gnu.org/hgweb/octave/file/e43d83253e28/liboctave/numeric/lo-mappers.h#l64



reply via email to

[Prev in Thread] Current Thread [Next in Thread]