This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51426] explicit instantiation declaration without definition
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 05 Dec 2011 18:54:11 +0000
- Subject: [Bug c++/51426] explicit instantiation declaration without definition
- Auto-submitted: auto-generated
- References: <bug-51426-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51426
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-12-05 18:54:11 UTC ---
I don't see what that paragraph has to do with it - the explicit instantiation
definition appears zero times, zero is less than one.
The relevant text is 14.7.2 p11
"An entity that is the subject of an explicit instantiation declaration and
that is also used in a way that would otherwise cause an implicit instantiation
(14.7.1) in the translation unit shall be the subject of an explicit
instantiation definition somewhere in the program; otherwise the program is
ill-formed, no diagnostic required."
The program is ill-formed, no diagnostic required.
If you change it so there's something that actually needs a definition you'll
get a linker error:
template <typename T>
struct A { A() { } };
extern template
struct A<int>;
int main()
{
A<int> a;
}
I don't see a bug here