<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - implicit instantiation of undefined template basic_streambuf when using istreambuf_iterator"
   href="https://llvm.org/bugs/show_bug.cgi?id=28057">28057</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>implicit instantiation of undefined template basic_streambuf when using istreambuf_iterator
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jasonliu.development@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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).</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>