LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 43063 - std::sort_heap use (possible deleted) operator,
Summary: std::sort_heap use (possible deleted) operator,
Status: RESOLVED FIXED
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Marshall Clow (home)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-20 09:37 PDT by Yichen Yan
Modified: 2019-08-20 14:36 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
test.cc (163 bytes, text/plain)
2019-08-20 09:37 PDT, Yichen Yan
Details
test.cc (934 bytes, text/x-csrc)
2019-08-20 11:21 PDT, Yichen Yan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yichen Yan 2019-08-20 09:37:42 PDT
Created attachment 22402 [details]
test.cc

Summary: std::sort_heap use (possible deleted) operator, and failed to compile if it's deleted.



Steps to Reproduce: clang++ -o /dev/null -std=c++11 --compile test.cc
 (test.cc attched)



Actual Results:
In file included from test.cc:1:
/home/yiyan/.local/bin/../include/c++/v1/algorithm:4998:67: error: overload resolution selected deleted operator ','
    for (difference_type __n = __last - __first; __n > 1; --__last, --__n)
                                                          ~~~~~~~~^ ~~~~~
/home/yiyan/.local/bin/../include/c++/v1/algorithm:5008:5: note: in instantiation of function template specialization 'std::__1::__sort_heap<std::__1::__less<int, int> &, random_access_iterator_wrapper<int> >' requested here
    __sort_heap<_Comp_ref>(__first, __last, __comp);
    ^
/home/yiyan/.local/bin/../include/c++/v1/algorithm:5016:12: note: in instantiation of function template specialization 'std::__1::sort_heap<random_access_iterator_wrapper<int>, std::__1::__less<int, int> >' requested here
    _VSTD::sort_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
           ^
test.cc:33:10: note: in instantiation of function template specialization 'std::__1::sort_heap<random_access_iterator_wrapper<int> >' requested here
    std::sort_heap(sortcon.begin(), sortcon.end());
         ^
test.cc:23:10: note: candidate function [with U = long] has been explicitly deleted
    void operator,(U) = delete;
         ^
1 error generated.



Expected Results: No error



Build Date & Hardware: Build 2019-08-20 on Linux x86_64
Comment 1 Marshall Clow (home) 2019-08-20 10:25:09 PDT
What version of clang/libc++ are you working off of?

Your test program compiles fine for me using trunk.
Comment 2 Marshall Clow (home) 2019-08-20 10:27:37 PDT
I think you attached the wrong file.
Comment 3 Marshall Clow (home) 2019-08-20 10:41:29 PDT
Never mind; I have reproduced it.
Comment 4 Yichen Yan 2019-08-20 11:21:49 PDT
Created attachment 22404 [details]
test.cc
Comment 5 Yichen Yan 2019-08-20 11:22:52 PDT
You are right, and I've updated the attachment, in case if it's needed.
Comment 6 Marshall Clow (home) 2019-08-20 14:36:22 PDT
Fixed in revision 369448