http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54145
Bug #: 54145 Summary: [4.6/4.7 Regression] no symbol generated for `void QMailThreadSortKey::deserialize<QDataStream>(QDataStre am&)' Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: d...@gcc.gnu.org Created attachment 27911 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27911 preprocessed source [forwarded from http://bugs.debian.org/667341] seen when building the qmf testsuite with 4.7 or the trunk. g++ -m64 -Wl,-O1 -o build/tst_qmailthread tst_qmailthread.o -L/usr/lib/x86_64-linux-gnu -L../../src/libraries/qmfclient/build -lqmfclient -lQtTest -lQtCore -lpthread tst_qmailthread.o: In function `tst_qmailthread::test_threadKeys()': tst_qmailthread.cpp:(.text+0x559b): undefined reference to `void QMailThreadSortKey::deserialize<QDataStream>(QDataStream&)' collect2: error: ld returned 1 exit status make[3]: *** [build/tst_qmailthread] Error 1 make[3]: Leaving directory `/home/packages/tmp/qmf-1.0.7~2011w23.2/tests/tst_qmailthread' the symbol is emitted in qmailthreadsortkey1.cpp, when built with 4.6 (both with -O1 and -O2), and with 4.7 with -O1, but not with -O2. Same behavior for the trunk. $ g++ -c -O1 -Wall -W -fPIC -o qmailthreadsortkey1.o qmailthreadsortkey1.cpp $ objdump -C -t qmailthreadsortkey1.o |grep deserialize 0000000000000000 l d .text._ZN15MailSortKeyImplI18QMailThreadSortKeyE11deserializeI11QDataStreamEEvRT_ 0000000000000000 .text._ZN15MailSortKeyImplI18QMailThreadSortKeyE11deserializeI11QDataStreamEEvRT_ 0000000000000000 l d .text._ZN18QMailThreadSortKey11deserializeI11QDataStreamEEvRT_ 0000000000000000 .text._ZN18QMailThreadSortKey11deserializeI11QDataStreamEEvRT_ 0000000000000000 w F .text._ZN15MailSortKeyImplI18QMailThreadSortKeyE11deserializeI11QDataStreamEEvRT_ 00000000000000a1 void MailSortKeyImpl<QMailThreadSortKey>::deserialize<QDataStream>(QDataStream&) 0000000000000000 w F .text._ZN18QMailThreadSortKey11deserializeI11QDataStreamEEvRT_ 0000000000000048 void QMailThreadSortKey::deserialize<QDataStream>(QDataStream&) $ g++ -c -O2 -Wall -W -fPIC -o qmailthreadsortkey1.o qmailthreadsortkey1.cpp $ objdump -C -t qmailthreadsortkey1.o |grep deserialize $