<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Template argument-dependent lookup fails to find a function in unnamed namespace"
   href="https://bugs.llvm.org/show_bug.cgi?id=35496">35496</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Template argument-dependent lookup fails to find a function in unnamed namespace
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>trupwszafie@o2.pl
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19507" name="attach_19507" title="File reproducing the issue.">attachment 19507</a> <a href="attachment.cgi?id=19507&action=edit" title="File reproducing the issue.">[details]</a></span>
File reproducing the issue.

Template function fails to find operator>> overloading, when the operator>>
function is defined in unnamed namespace. Error message:

c1.cpp:16:9: error: call to function 'operator>>' that is neither visible in
the template definition nor found by argument-dependent lookup
    iss >> result;
        ^
c1.cpp:39:15: note: in instantiation of function template specialization
'Bar::convert<Bar::Foo>' requested here
  return !bar.convert("bar foo", foo);
              ^
c1.cpp:27:17: note: 'operator>>' should be declared prior to the call site or
in the global namespace
  std::istream& operator>>(std::istream& is, Bar::Foo& foo)

I think it should compile as unnamed namespace specifies internal linkage like
static keyword. When unnamed namespace is replaced with static keyword the code
compiles, so the behavior seems pretty inconsistent.</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>