[llvm-bugs] [Bug 28057] New: implicit instantiation of undefined template basic_streambuf when using istreambuf_iterator

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 8 14:44:49 PDT 2016


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

            Bug ID: 28057
           Summary: implicit instantiation of undefined template
                    basic_streambuf when using istreambuf_iterator
           Product: libc++
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jasonliu.development at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

I tried to compile the following code with libc++ but failed:

#include <iterator>
#include <string>
int main(int argc, char *argv[])
{
    std::istreambuf_iterator<char, std::char_traits<char> > myit; 
    bool b = myit != myit;

    return 0;
}

I got the following error message:
 error: implicit instantiation of undefined template
'std::__1::basic_streambuf<char, std::__1::char_traits<char> >'
        if (__sbuf_ &&
traits_type::eq_int_type(__sbuf_->sgetc(),traits_type::eof()))
                                                       ^

I think the problem happens because we are trying to call the member function
"sgetc()" in class streambuf. But we only have the forward declaration of class
streambuf. 

Notice that when I try to include streambuf header at the beginning of iterator
header, I will get circular reference error(streambuf header includes other
headers that will include iterator header again).

-- 
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/20160608/cbfd73e1/attachment.html>


More information about the llvm-bugs mailing list