<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:ehsan@mozilla.com" title="Ehsan Akhgari [:ehsan] <ehsan@mozilla.com>"> <span class="fn">Ehsan Akhgari [:ehsan]</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - clang-cl imports an incorrect data symbol for dllimported classes inside a namespace with a default ctor which have a local static member"
   href="https://llvm.org/bugs/show_bug.cgi?id=24291">bug 24291</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>WORKSFORME
           </td>
           <td>---
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Summary</td>
           <td>clang-cl doesn't respect noinline on methods of dllimported classes
           </td>
           <td>clang-cl imports an incorrect data symbol for dllimported classes inside a namespace with a default ctor which have a local static member
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - clang-cl imports an incorrect data symbol for dllimported classes inside a namespace with a default ctor which have a local static member"
   href="https://llvm.org/bugs/show_bug.cgi?id=24291#c8">Comment # 8</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - clang-cl imports an incorrect data symbol for dllimported classes inside a namespace with a default ctor which have a local static member"
   href="https://llvm.org/bugs/show_bug.cgi?id=24291">bug 24291</a>
              from <span class="vcard"><a class="email" href="mailto:ehsan@mozilla.com" title="Ehsan Akhgari [:ehsan] <ehsan@mozilla.com>"> <span class="fn">Ehsan Akhgari [:ehsan]</span></a>
</span></b>
        <pre>It turns out that the test case in <a href="show_bug.cgi?id=24291#c0">comment 0</a> was completely wrong, sorry for
the red herring.  Here is a minimized test case that demonstrates the
difference between cl and clang-cl:

$ cat test.cpp
namespace foo {

class __declspec(dllimport) S {
public:
  static S* Instance() {
    static S s;
    return &s;
  }
  S() {}
};

}

void use() {
  foo::S::Instance();
}

$ clang-cl -c -O1 test.cpp && llvm-nm test.obj
00000000 T ?use@@YAXXZ
00000001 a @feat.00
         U __imp_??_B?1??Instance@S@foo@@SAPAV12@XZ@51

$ cl -nologo -c -O1 test.cpp && llvm-nm test.obj
test.cpp
00000000 T ?use@@YAXXZ
00e1797d a @comp.id
80000191 a @feat.00
         U __imp_?Instance@S@foo@@SAPAV12@XZ


Note that if you drop the default ctor from S, or move S to the global
namespace, the bug goes away!</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>