<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 - Unexpected internal linkage when using an alias to an private class"
   href="https://bugs.llvm.org/show_bug.cgi?id=37279">37279</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unexpected internal linkage when using an alias to an private class
          </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>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>oliver@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I am not sure if clang's behaviour is wrong, but the behaviour is unexpected.
The basic issue is that I can have a public alias to a private type, but if the
alias appears in a method declaration the method is given internal linkage.

Here's a trivial example (compile with clang++ -c):

namespace Foo {
    namespace {
         struct _X {
             int y;
        };
    }
    using X = _X;
}
namespace Foo {
    struct Bar {
        X womp();
    };
}
Foo::Bar *thing();
int main() {
    thing()->womp();
    return 0;
}

<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - incorrect has internal linkage but is not defined [-Wundefined-internal] reported when a private class is used in a template"
   href="show_bug.cgi?id=20296">Bug 20296</a> seems to be similar, but that seems to be related to class protection
rather than anonymous namespaces

Given that the X alias public it seems expected that the method should not
receive internal linkage. That would be my /expectation/, if the actual
specification is different, it would be great if the warning actually said why
a method got internal linkage.</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>