<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 --- - inconsistent unqualified lookup for friend declaration" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24088&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gBMypx3haKN_azM8q44kJOaTjnQY9_USj8tTy4f-Bzk&s=r19YujlHdjpLq2ns8juL1a0vAuAYMknWkMC3UlCvlU4&e=">24088</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>inconsistent unqualified lookup for friend declaration
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>barry.revzin@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following code, courtesy of Belloc
(<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__stackoverflow.com_q_31348475_2069064&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gBMypx3haKN_azM8q44kJOaTjnQY9_USj8tTy4f-Bzk&s=eSleGdTQO9YBIhudamRuxtZfXYKTfzcnj3qRVgrB83o&e=">http://stackoverflow.com/q/31348475/2069064</a>):

struct Outer {
    void f() { }
    class C { };

    class Inner {
        friend class C;
        friend void f();
        static const int i = 0;
    };
};

void f() { int i = Outer::Inner::i; }
class C { int i = Outer::Inner::i; };

int main() { }

According to [namespace.memdef]/3, "the lookup to determine whether the entity
has been previously declared shall not consider any scopes outside the
innermost enclosing namespace." 

There's some confusion as to what "outside" means in this context, but
regardless both GCC and Clang are inconsistent in their interpretation. Either
it means exclusively the innermost enclosing namespace (in which case both ::f
and ::C should be friends) or it just means stop at the innermost enclosing
namespace (in which case both Outer::f and Outer::C should be friends). But in
this case, both GCC and Clang friend ::f and Outer::C, which is a bug in one
direction or the other.</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>