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: unassignedclangb...@nondot.org
Reporter: wdehne...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs