[LLVMbugs] [Bug 19153] New: Some iterators non-standard

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 15 19:36:15 PDT 2014


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

            Bug ID: 19153
           Summary: Some iterators non-standard
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stevemac at microsoft.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

This is one of our MSVC STL tests.  I only looked up the back_insert_iterator
in the standard, but we are of the opinion that our test is standard.  If you
agree, we are happy to contribute the full test case which is listed at the
very bottom as a self-contained repro.  

Environment: 
clang version 3.5.0 (trunk 203997)
Target: x86_64-unknown-linux-gnu
Thread model: posix

N3797:
24.5.2.1 Class template back_insert_iterator
 [back.insert.iterator]
namespace std {
template <class Container>
class back_insert_iterator :
public iterator<output_iterator_tag,void,void,void,void>{

Repro Snippet (full repro at the end)
 typedef vector<int> vec_t;
    typedef iterator<output_iterator_tag, void, void, void, void> outit_t;
    typedef iterator<input_iterator_tag, int, ptrdiff_t, const int *, const
int&> istrit_t;
    typedef iterator<input_iterator_tag, char, streamoff, const char *, char>
istrbufit_t;
    typedef iterator<random_access_iterator_tag, int, ptrdiff_t, int *, int&>
revit_t;

    static_assert(is_base_of<    outit_t,  back_insert_iterator<vec_t>    
>::value,  "back_insert_iterator");
    static_assert(is_base_of<    outit_t, front_insert_iterator<vec_t>    
>::value, "front_insert_iterator");
    static_assert(is_base_of<    outit_t,       insert_iterator<vec_t>    
>::value,       "insert_iterator");
    static_assert(is_base_of<    outit_t,  raw_storage_iterator<int *,
int>>::value,  "raw_storage_iterator");
    static_assert(is_base_of<istrbufit_t,   istreambuf_iterator<char>     
>::value,   "istreambuf_iterator");

Compile:
clang++ -std=c++11 -stdlib=libc++ -I/libcxx/include -L/libcxx/lib
is_base_of_iter.pass.cpp 

Thanks,
Steve MacKenzie
Microsoft Visual C++ Libraries

Here's the self contained repro:
#include <stddef.h>
#include <ios>
#include <iterator>
#include <memory>
#include <streambuf>
#include <type_traits>
#include <vector>
using namespace std;

int main() {
    typedef vector<int> vec_t;
    typedef iterator<output_iterator_tag, void, void, void, void> outit_t;
    typedef iterator<input_iterator_tag, int, ptrdiff_t, const int *, const
int&> istrit_t;
    typedef iterator<input_iterator_tag, char, streamoff, const char *, char>
istrbufit_t;
    typedef iterator<random_access_iterator_tag, int, ptrdiff_t, int *, int&>
revit_t;

    static_assert(is_base_of<    outit_t,  back_insert_iterator<vec_t>    
>::value,  "back_insert_iterator");
    static_assert(is_base_of<    outit_t, front_insert_iterator<vec_t>    
>::value, "front_insert_iterator");
    static_assert(is_base_of<    outit_t,       insert_iterator<vec_t>    
>::value,       "insert_iterator");
    static_assert(is_base_of<   istrit_t,      istream_iterator<int>      
>::value,      "istream_iterator");
    static_assert(is_base_of<    outit_t,      ostream_iterator<int>      
>::value,      "ostream_iterator");
    static_assert(is_base_of<    outit_t,  raw_storage_iterator<int *,
int>>::value,  "raw_storage_iterator");
    static_assert(is_base_of<istrbufit_t,   istreambuf_iterator<char>     
>::value,   "istreambuf_iterator");
    static_assert(is_base_of<    outit_t,   ostreambuf_iterator<char>     
>::value,   "ostreambuf_iterator");
    static_assert(is_base_of<    revit_t,      reverse_iterator<int *>    
>::value,      "reverse_iterator");


    // DevDiv#557214 "std::forward_iterator_tag derives from
std::output_iterator_tag"
    static_assert(is_base_of<input_iterator_tag, forward_iterator_tag>::value,
        "forward_iterator_tag should derive from input_iterator_tag");
    static_assert(is_base_of<forward_iterator_tag,
bidirectional_iterator_tag>::value,
        "bidirectional_iterator_tag should derive from forward_iterator_tag");
    static_assert(is_base_of<bidirectional_iterator_tag,
random_access_iterator_tag>::value,
        "random_access_iterator_tag should derive from
bidirectional_iterator_tag");

    static_assert(!is_base_of<output_iterator_tag, input_iterator_tag>::value,
        "input_iterator_tag should NOT derive from output_iterator_tag");
    static_assert(!is_base_of<output_iterator_tag,
forward_iterator_tag>::value,
        "forward_iterator_tag should NOT derive from output_iterator_tag");
    static_assert(!is_base_of<output_iterator_tag,
bidirectional_iterator_tag>::value,
        "bidirectional_iterator_tag should NOT derive from
output_iterator_tag");
    static_assert(!is_base_of<output_iterator_tag,
random_access_iterator_tag>::value,
        "random_access_iterator_tag should NOT derive from
output_iterator_tag");
}

-- 
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/20140316/2b2a24a3/attachment.html>


More information about the llvm-bugs mailing list