<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 --- - [ms][dll] clang generates a COFF symbol table that differs from msvc with __declspec(dllimport)"
   href="https://llvm.org/bugs/show_bug.cgi?id=26936">26936</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ms][dll] clang generates a COFF symbol table that differs from msvc with __declspec(dllimport)
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>andrey.kuleshov@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>!- Clang is not adding template functions with __declspec(dllimport) to the
COFF symbol table, this behavior differs from a behavior of msvc -!

=========Environment=============
OS: Win 
Lang: c++
Version: trunk

=========Reproducer==============
test.cpp
-----------
template<class _E>
struct basic_string {
        void func(int npos);
        static const int npos;
};

template<class _E> const int
                basic_string<_E>::npos = -1;

typedef basic_string<char> string;
string s;

int main()
{
s.func(basic_string<char>::npos);
return 0;
}

template <class T>
basic_string<T> foo() { return s; }

template class  __declspec(dllimport) basic_string<char> foo();
-----------
$ cl -c test.cpp /Fomstest.obj
$ clang-cl -c test.cpp /Foclangtest.obj

===========Output================
<span class="quote">>>> MSVC (vs2015):</span >
$ dumpbin /symbols mstest.obj | grep -i dllimport | cut -f2 -d"|"
 __imp_?func@?$basic_string@D@@QEAAXH@Z (__declspec(dllimport) public: void
__cdecl basic_string<char>::func(int))

<span class="quote">>>> clang:</span >
$  dumpbin /symbols clangtest.obj | grep -i dllimport | cut -f2 -d"|"
<empty output>


Andrey Kuleshov
======
Software Engineer
Intel Compiler Team</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>