https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60796
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|UNCONFIRMED |NEW Last reconfirmed| |2016-04-21 Ever confirmed|0 |1 Known to fail| |5.3.0, 6.0, 7.0 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Clang and G++ behave the same, they don't emit the defaulted members in either translation unit. EDG emits them in main.o where they are needed (but not in A.o) template <typename T> struct shared_ptr { shared_ptr(T*) { } shared_ptr(const shared_ptr&) { } shared_ptr(shared_ptr&&) { } ~shared_ptr() { } }; template <typename T> struct A { A (T* a) : a(a) {} A() = default; A(A&&) = default; A& operator =(const A&) = default; shared_ptr<T> a; }; extern template struct A<int>; int main() { A<int> a = new int(19); A<int> b = static_cast<A<int>&&>(a); } g++ -c main.C nm -C main.o U _Unwind_Resume 0000000000000000 W shared_ptr<int>::~shared_ptr() 0000000000000000 W shared_ptr<int>::~shared_ptr() 0000000000000000 n shared_ptr<int>::~shared_ptr() U A<int>::A(A<int>&&) U A<int>::A(int*) 0000000000000000 W A<int>::~A() 0000000000000000 W A<int>::~A() 0000000000000000 n A<int>::~A() U operator new(unsigned long) U __gxx_personality_v0 0000000000000000 T main clang++ -std=c++11 -c main.C nm -C main.o 0000000000000000 r GCC_except_table0 U _Unwind_Resume 0000000000000000 W shared_ptr<int>::~shared_ptr() U A<int>::A(A<int>&&) U A<int>::A(int*) 0000000000000000 W A<int>::~A() U operator new(unsigned long) U __gxx_personality_v0 0000000000000000 T main edg --c++11 main.C nm -C main.o 000000000000015c W shared_ptr<int>::~shared_ptr() 00000000000001a0 W shared_ptr<int>::~shared_ptr() 00000000000002a8 T A<int>::A(A<int>&&) 00000000000001e4 T A<int>::A(int*) 0000000000000344 T A<int>::A(A<int>&&) 0000000000000280 T A<int>::A(int*) 000000000000036c W A<int>::~A() 0000000000000474 W A<int>::~A() U operator delete(void*) U operator new(unsigned long) 0000000000000004 C __EDGCPFE__4_9 0000000000000050 d __T12929048.1926 0000000000000040 d __T12932616.1915 0000000000000060 d __T12934328.1936 0000000000000000 d __T12936536.1896 U __curr_eh_stack_entry U __eh_curr_region 0000000000000000 T main