[llvm-bugs] [Bug 39649] New: clang fails to generate defaulted move constructor upon template instantiation
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Nov 13 10:02:33 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39649
Bug ID: 39649
Summary: clang fails to generate defaulted move constructor
upon template instantiation
Product: clang
Version: unspecified
Hardware: All
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: wdehnen64 at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
I couldn't reduce the error below this three file example:
// file unit.h:
#include <vector>
template<typename T>
struct foo
{
std::vector<T> data;
foo(foo&&) = default; // no code generated, even if odr-used.
foo(std::vector<T>&&v) : data(std::move(v)) {}
};
extern template struct foo<int>; // indicates instantiation elsewhere
// file unit.cc:
#include "unit.h"
template struct foo<int>; // forces instantiation
// file main.cc:
#include "unit.h"
struct bar
{
foo<int> f;
bar(foo<int>&&x) : f(std::move(x)) {}
};
bar makeBar()
{
foo<int> f(std::vector<int>(5));
return {std::move(f)};
}
int main()
{
bar x=makeBar();
}
clang++ -std=c++11 main.cc unit.cc
produces:
Undefined symbols for architecture x86_64:
"foo<int>::foo(foo<int>&&)", referenced from:
bar::bar(foo<int>&&) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181113/5bbc1d5a/attachment.html>
More information about the llvm-bugs
mailing list