This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51426] explicit instantiation declaration without definition


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]