[llvm-bugs] [Bug 27741] New: Implement DR 1137 - Real return types for std::conj(float) and friends

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 13 15:21:10 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27741

            Bug ID: 27741
           Summary: Implement DR 1137 - Real return types for
                    std::conj(float) and friends
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hfinkel at anl.gov
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

libc++, unlike libstdc++, does not implement DR 1137, which says that the
return type of std::conj(float) should be float, not std::complex<float>.

inline _LIBCPP_INLINE_VISIBILITY
complex<float>
conj(float __re)
{
    return complex<float>(__re);
}

The proposed resolution to DR 1137 was to add:

  All of the specified overloads shall have a return type which is the nested
value_type of the effectively cast arguments.

  http://lwg.github.io/issues/lwg-defects.html#1137

to 26.4.9, although I don't see that text in the standard itself - I'm not sure
what happened in that regard. libstdc++ has:

  // DR 1137.
  template<typename _Tp>
    inline typename __gnu_cxx::__promote<_Tp>::__type
    proj(_Tp __x)
    { return __x; }

  template<typename _Tp>
    inline typename __gnu_cxx::__promote<_Tp>::__type
    conj(_Tp __x)
    { return __x; }

We have code that, as a result of this, compiles with libstdc++, but not with
libc++.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160513/67829086/attachment.html>


More information about the llvm-bugs mailing list