<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 - [Win] Assertion failed: D->getCachedLinkage() == LV.getLinkage()"
   href="https://bugs.llvm.org/show_bug.cgi?id=42364">42364</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Win] Assertion failed: D->getCachedLinkage() == LV.getLinkage()
          </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>Windows NT
          </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>Modules
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mikhail.strelnikov@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22132" name="attach_22132" title="reproduces the bug">attachment 22132</a> <a href="attachment.cgi?id=22132&action=edit" title="reproduces the bug">[details]</a></span>
reproduces the bug

TL;DR Please see attached 'build.bat' 

file: my.cppm

    export module my;
    template <class>
    struct v {
        ~v(){} // works, if destructor is removed
    };
    export v<int> foo(){ throw 1; }


file: main.cpp

    import my;
    int main(){ foo(); }


file: commands.bat

    set CC="C:\Program Files\LLVM\bin\clang++.exe"
    %CC% -std=c++2a -fmodules-ts --precompile my.cppm -fprebuilt-module-path=.
-o my.pcm
    %CC% -std=c++2a -fmodules-ts -c my.pcm -o my.o
    %CC% -std=c++2a -fmodules-ts -fuse-ld=lld -fprebuilt-module-path=. my.o
main.cpp -o main.exe



On Linux it does not fail on assert. It emits quite confusing warning, then
refuses to link:

my.cppm:4:5: warning: inline function 'v<int>::~v' is not defined
[-Wundefined-inline]
    ~v(){}
    ^
main.cpp:2:13: note: used here
int main(){ foo(); }
            ^
1 warning generated.
ld.lld: error: undefined symbol: _ZW2myEN1vIiED1Ev</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>