<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 --- - inline namespace template ambiguities not well diagnosed"
   href="https://llvm.org/bugs/show_bug.cgi?id=31660">31660</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>inline namespace template ambiguities not well diagnosed
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.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>normal
          </td>
        </tr>

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

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

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

        <tr>
          <th>Reporter</th>
          <td>hfinkel@anl.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>eric@efcs.ca, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given this code:

$ cat /tmp/t6.cpp 
namespace ns {
inline namespace in {
template <class T>
class foo { };
}
}

namespace ns {
template <class T>
class foo { };
}

using namespace ns;
foo<int> x;

We produce only this error:

$ clang -stdlib=libc++ -fsyntax-only /tmp/t6.cpp -std=c++14
/tmp/t6.cpp:14:1: error: unknown type name 'foo'
foo<int> x;
^
/tmp/t6.cpp:14:4: error: expected unqualified-id
foo<int> x;
   ^
2 errors generated.

This is really confusing. The problem, I can only suppose, is that the lookup
is ambiguous, but we don't say that (and, thus, we fail to point out the
relevant candidates).

If foo were not a template, like this:

$ cat /tmp/t7.cpp 
namespace ns {
inline namespace in {
class foo { };
}
}

namespace ns {
class foo { };
}

using namespace ns;
foo x;

then we produce a very sensible error:

$ clang -stdlib=libc++ -fsyntax-only /tmp/t7.cpp -std=c++14
/tmp/t7.cpp:12:1: error: reference to 'foo' is ambiguous
foo x;
^
/tmp/t7.cpp:3:7: note: candidate found by name lookup is 'ns::in::foo'
class foo { };
      ^
/tmp/t7.cpp:8:7: note: candidate found by name lookup is 'ns::foo'
class foo { };
      ^
1 error generated.

Can we do better in the template case?</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>