https://bugs.llvm.org/show_bug.cgi?id=42364

            Bug ID: 42364
           Summary: [Win] Assertion failed: D->getCachedLinkage() ==
                    LV.getLinkage()
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Modules
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Created attachment 22132
  --> https://bugs.llvm.org/attachment.cgi?id=22132&action=edit
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to