public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/51426] explicit instantiation declaration without definition
Date: Mon, 05 Dec 2011 18:55:00 -0000	[thread overview]
Message-ID: <bug-51426-4-tfvFitGj95@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <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


  reply	other threads:[~2011-12-05 18:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05 18:41 [Bug c++/51426] New: " mkp76 at wp dot pl
2011-12-05 18:55 ` redi at gcc dot gnu.org [this message]
2011-12-05 23:46 ` [Bug c++/51426] " paolo.carlini at oracle dot com
2011-12-06  0:33 ` redi at gcc dot gnu.org
2011-12-06 17:49 ` mkp76 at wp dot pl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51426-4-tfvFitGj95@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).