[LLVMbugs] [Bug 12034] New: Error for non-destroyable return type of overloaded call hard to understand

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 19 00:16:02 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=12034

             Bug #: 12034
           Summary: Error for non-destroyable return type of overloaded
                    call hard to understand
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


In one of libc++'s tests (at r150835), I got the following error:


In file included from
/home/jyasskin/src/libcxx/src/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp:17:
In file included from /home/jyasskin/src/libcxx/src/include/algorithm:591:
/home/jyasskin/src/libcxx/src/include/type_traits:3048:22: error: attempt to
use a deleted
      function
    typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>()))
type;
                     ^
/home/jyasskin/src/libcxx/src/include/type_traits:3056:48: note: in
instantiation of
      template class 'std::__1::__detail::__swappable<const int &>' requested
here
    : public integral_constant<bool, __detail::__swappable<_Tp>::value>
                                               ^
/home/jyasskin/src/libcxx/src/include/type_traits:3077:41: note: in
instantiation of
      template class 'std::__1::__is_swappable<const int &>' requested here
    : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp>
                                        ^
/home/jyasskin/src/libcxx/src/include/utility:336:32: note: in instantiation of
template
      class 'std::__1::__is_nothrow_swappable<const int &>' requested here
    swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
                               ^
/home/jyasskin/src/libcxx/src/include/__config:238:34: note: expanded from
macro
      '_NOEXCEPT_'
#  define _NOEXCEPT_(x) noexcept(x)
                                 ^
/home/jyasskin/src/libcxx/src/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp:25:39:
note: 
      in instantiation of template class 'std::__1::pair<const int &, const int
&>'
      requested here
    std::pair<const T&, const T&> p = std::minmax(a, b, c);
                                      ^
/home/jyasskin/src/libcxx/src/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp:35:5:
note: 
      in instantiation of function template specialization 'test<int,
      std::__1::greater<int> >' requested here
    test(x, y, std::greater<int>(), x, y);
    ^
/home/jyasskin/src/libcxx/src/include/type_traits:832:5: note: function has
been
      explicitly marked deleted here
    ~__nat() = delete;
    ^
1 error generated.



You'll note that __nat is mentioned for the first time in the line at the
bottom saying what function was deleted, and it's not clear why it would matter
since the arguments to swap are "const int &"s. Instead, the initial error
message should include a note saying the overload that was selected (before the
instantiation backtrace).

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list