<html>
    <head>
      <base href="http://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 --- - clang drops dllimport attribute from qualified friend declaration of imported function"
   href="http://llvm.org/bugs/show_bug.cgi?id=20512">20512</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang drops dllimport attribute from qualified friend declaration of imported function
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, rnk@google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider this example:

  __declspec(dllimport) void f();
  struct S {
    friend void ::f();
    S() { f(); };
  };
  S s;

Clang warns about the redeclaration of 'f' and drops the dllimport attribute
(MinGW does the same). MSVC on the other hand accepts this code, and treats 'f'
as an imported function.

It is interesting to note that the qualifier in the friend declaration is
significant. In the same example without qualifier:

  __declspec(dllimport) void f();
  struct S {
    friend void f();
    S() { f(); };
  };
  S s;

MSVC warns about the inconsistent dll linkage, and does not treat 'f' as
imported.

The latter example suggests that it is sensible to warn here, and MSVC not
warning in the qualified case might be a glitch. If that's the case, I'm not
sure we want to replicate that behaviour.</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>