llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[Win] Assertion failed: D->getCachedLinkage() == LV.getLinkage()

Open llvmbot opened this issue 7 years ago • 1 comments

Bugzilla Link 42364
Version unspecified
OS Windows NT
Attachments reproduces the bug
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid

Extended Description

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::~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

llvmbot avatar Jun 23 '19 22:06 llvmbot

Looks like it's fixed: https://compiler-explorer.com/z/KzzvdcTfv. It also does not trigger assertions on Windows locally.

MagentaTreehouse avatar Mar 27 '25 00:03 MagentaTreehouse