http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60796
--- Comment #1 from Brian Freyburger <brian.freyburger at blandertechnologies
dot com> ---
Sorry, see code change below. (if you explicitly instantiate in the
compilation unit which uses the move construction, the compilation sucec
(In reply to Brian Freyburger from comment #0)
> When you use explicit template instantiation in separate compilation units,
> and disable implicit instantiation, a move constructor and move assignment
> operator defined as "=default" is not generated.
>
> See example here:
>
> A.H:
>
> #include <memory>
>
> template <typename T>
> struct A
> {
> A (T*a) : a(a) {}
>
> A(A&&) = default;
> A& operator =(const A&) = default;
>
> std::shared_ptr<T> a;
> };
>
> extern template class A<int>;
>
> A.C:
>
> #include "A.H"
>
> template class A<int>;
>
> main.C:
>
> #include "A.H"
>
> // template class A<int>; REMOVE THIS LINE
> int main()
> {
> A<int> a = new int(19);
> A<int> b = std::move(a);
> }
>
>
> results:
>
> g++ -std=c++11 A.C main.C
> /tmp/ccvE1IqS.o: In function `main':
> main.C:(.text+0xdc): undefined reference to `A<int>::A(A<int>&&)'
> collect2: error: ld returned 1 exit status