<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 - CLANG including struct names when looking up namespace name candidates"
   href="https://bugs.llvm.org/show_bug.cgi?id=45216">45216</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CLANG including struct names when looking up namespace name candidates
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kjmathew@outlook.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The below code compiles on GCC but not on CLANG. Looks like CLANG is looking up
struct identifier names as ns_name candidates in addition to namespace names in
"using ns_name::name;".

<a href="https://wandbox.org/permlink/zG6JvMtNwxXK4yPn">https://wandbox.org/permlink/zG6JvMtNwxXK4yPn</a>

////////////////////////////////////////////////////////////////////////////
#include<stdio.h>

namespace N1 {
   const char* f() {
      return "NamespaceN1::f()";
    }
}

namespace N2 {
  struct N1 {
    static const char* f() {
      return "NamespaceN2::StructN1::f()";
    }
  };
}

using namespace N2;
using N1::f;

int main()
{
    printf("%s\n", f());
    return 0;
}

////////////////////////////////////////////////////////////////////////////
Compilation Error on CLANG:

prog.cc:18:7: error: reference to 'N1' is ambiguous
using N1::f;
      ^
prog.cc:3:11: note: candidate found by name lookup is 'N1'
namespace N1 {
          ^
prog.cc:10:10: note: candidate found by name lookup is 'N2::N1'
  struct N1 {
         ^
prog.cc:22:20: error: use of undeclared identifier 'f'; did you mean 'N1::f'?
    printf("%s\n", f());
                   ^
                   N1::f
prog.cc:4:16: note: 'N1::f' declared here
   const char* f() {
               ^
2 errors generated.

////////////////////////////////////////////////////////////////////////////
Result on GCC:

NamespaceN1::f()</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>