[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Jason Merrill changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |6.3 --- Comment #16 from Jason Merrill --- Yes.
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 --- Comment #15 from Jonathan Wakely --- Jens, see the discussion in https://bugs.llvm.org/show_bug.cgi?id=22763 Jason, should this be closed as FIXED for 6.3 and up? I believe what Jens observes is the intended behaviour of GCC and Clang now.
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Jonathan Wakely changed: What|Removed |Added CC||jlink at drw dot com --- Comment #14 from Jonathan Wakely --- *** Bug 67632 has been marked as a duplicate of this bug. ***
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Jens Maurer changed: What|Removed |Added CC||jens.maurer at gmx dot net --- Comment #13 from Jens Maurer --- This bug saw its last activity nearly a year ago, with patches from Jason applied, but the issue does not seem to be fixed in its entirety (using gcc 7.2). Specifically, this translation unit: template struct C { C() = default; void f() { } int i = 5; }; template class C; causes C::f() to be defined, but the defaulted constructor of C is not defined. (Replacing "= default" with "{}" causes definition of the C constructor.) $ nm -C x.o W C::f() The current behavior is obviously not what we want if we choose to use explicit instantiations.
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 --- Comment #12 from Jason Merrill --- Author: jason Date: Tue Dec 6 18:51:37 2016 New Revision: 243311 URL: https://gcc.gnu.org/viewcvs?rev=243311=gcc=rev Log: PR c++/57728 - explicit instantiation and defaulted functions * pt.c (do_type_instantiation): Don't mess with non-user-provided member functions. Added: branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp0x/explicit12.C Modified: branches/gcc-6-branch/gcc/cp/ChangeLog branches/gcc-6-branch/gcc/cp/class.c branches/gcc-6-branch/gcc/cp/pt.c
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 --- Comment #11 from Jason Merrill --- Author: jason Date: Thu Sep 1 01:55:47 2016 New Revision: 239913 URL: https://gcc.gnu.org/viewcvs?rev=239913=gcc=rev Log: PR c++/57728 - adjust testcase * g++.dg/cpp0x/explicit12.C: Add -save-temps. Modified: trunk/gcc/testsuite/g++.dg/cpp0x/explicit12.C
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 mwahab at gcc dot gnu.org changed: What|Removed |Added CC||mwahab at gcc dot gnu.org --- Comment #10 from mwahab at gcc dot gnu.org --- For aarch64 and arm, the new test g++.dg/cpp0x/explicit12.C shows as UNRESOLVED and the log complain about output files not existing. The test has { dg-do link .. } and { dg-final { scan-assembler-not .. } } but dg-do link doesn't seem to preserve the assembler files. Was the test intended to have a { dg-options "-save-temps" } set? Matthew
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 --- Comment #9 from Jason Merrill --- Author: jason Date: Fri Aug 26 15:10:51 2016 New Revision: 239782 URL: https://gcc.gnu.org/viewcvs?rev=239782=gcc=rev Log: PR c++/57728 - explicit instantiation and defaulted functions * pt.c (do_type_instantiation): Don't mess with non-user-provided member functions. Added: trunk/gcc/testsuite/g++.dg/cpp0x/explicit11.C trunk/gcc/testsuite/g++.dg/cpp0x/explicit12.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/cp/pt.c
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Jason Merrill changed: What|Removed |Added CC||brian.freyburger@blandertec ||hnologies.com --- Comment #8 from Jason Merrill --- *** Bug 60796 has been marked as a duplicate of this bug. ***
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Jonathan Wakely changed: What|Removed |Added CC||m_v_ at gmx dot net --- Comment #6 from Jonathan Wakely --- *** Bug 51629 has been marked as a duplicate of this bug. ***
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Jonathan Wakely changed: What|Removed |Added CC||m_v_ at gmx dot net --- Comment #6 from Jonathan Wakely --- *** Bug 51629 has been marked as a duplicate of this bug. *** --- Comment #7 from Jonathan Wakely --- Related to (and maybe a dup of) PR 60796 Also https://llvm.org/bugs/show_bug.cgi?id=22763
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Jonathan Wakely changed: What|Removed |Added CC||rustamabd at gmail dot com --- Comment #5 from Jonathan Wakely --- *** Bug 76521 has been marked as a duplicate of this bug. ***
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Paolo Carlini paolo.carlini at oracle dot com changed: What|Removed |Added CC||edward.hades at gmail dot com --- Comment #4 from Paolo Carlini paolo.carlini at oracle dot com --- *** Bug 58078 has been marked as a duplicate of this bug. ***
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 Jonathan Wakely redi at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2013-06-26 CC||jason at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely redi at gcc dot gnu.org --- The explicit instantiation declaration suppresses the definition of Aint::A() in defaulted.o, but the explicit instantiation definition doesn't cause that symbol to be emitted in impl.o, so when that constructor is not inlined there is no definition. As a single file: templatetypename T struct A { T x; A() = default; A(const A other) = delete; }; extern template class Aint; int main() { Aint a; } This compiles with clang but not G++ because Clang doesn't create a reference to Aint::A() from main(), so it doesn't matter that the explicit instantiation is not defined in the program.
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 --- Comment #2 from Bruce Merry bmerry at gmail dot com --- (In reply to Jonathan Wakely from comment #1) The explicit instantiation declaration suppresses the definition of Aint::A() in defaulted.o, but the explicit instantiation definition doesn't cause that symbol to be emitted in impl.o, so when that constructor is not inlined there is no definition. That's more or less what I figured was happening. Can you clarify whether you think this a GCC bug or just me misunderstanding the language? Thanks.
[Bug c++/57728] Explicit template instantiation with defaulted method causes missing symbol
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 --- Comment #3 from Jonathan Wakely redi at gcc dot gnu.org --- It's a bug