https://bugs.llvm.org/show_bug.cgi?id=33778
Bug ID: 33778
Summary: Destructor not generated for std::function<void()>
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: a...@xnor.ai
CC: llvm-bugs@lists.llvm.org
Created attachment 18787
--> https://bugs.llvm.org/attachment.cgi?id=18787&action=edit
reduced test case
When compiling the attached case.cc with Clang,
std::function<void()>::~function() is not generated, causing a link failure:
% clang++ -std=c++11 case.cc
/tmp/case-042075.o: In function `foo(std::function<void ()> const&)':
case.cc:(.text+0x79): undefined reference to `std::function<void
()>::~function()'
clang-4.0: error: linker command failed with exit code 1 (use -v to see
invocation)
GCC does generate ~function() in this case, however:
% g++ -std=c++11 case.cc
% # OK
The problem seems to occur under both libstdc++ and libc++. I have also
attached a reduced version of the preprocessed code (using libstdc++),
case-pp.cc, demonstrating the same problem. (case-pp.cc will have additional
link errors for function::function(function const&) which are expected)
I have tested this on:
- clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final), target:
x86_64-pc-linux-gnu
- Apple LLVM version 8.1.0 (clang-802.0.42), target: x86_64-apple-darwin16.6.0
- clang version 4.0.1 (tags/RELEASE_401/final), target:
x86_64-unknown-linux-gnu
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs