public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Wolfgang Bangerth <bangerth@ices.utexas.edu> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/10307: constructor for static object of template omitted Date: Fri, 04 Apr 2003 20:26:00 -0000 [thread overview] Message-ID: <20030404202600.8540.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/10307; it has been noted by GNATS. From: Wolfgang Bangerth <bangerth@ices.utexas.edu> To: Douglas Kilpatrick <kilpatds@oppositelock.org> Cc: gcc-gnats@gcc.gnu.org Subject: Re: c++/10307: constructor for static object of template omitted Date: Fri, 4 Apr 2003 14:17:24 -0600 (CST) > I would have though that a subclass of a template by a non-template would > cause the template to be instantiated, but it doesn't seem to. I have to > declare an explicit variable of the non-template class to get things to > work. Well, each component of a template can be instantiated in two ways: - an explicit instantiation - implicit instantiation by using this part (i.e. using a template member function, etc) Note that in implicit instantiation, using one part of a template class doesn't imply that _all_ the parts are instantiated. Deriving from a class (and using the derived class) counts as implicit instantiation of the base class. > What's the syntax for forcing that without actually declaring a variable? > Its not a template, so using the explicit template instantation syntax > doesn't work. (Code freely available if you want it. ~6k) Just as I wrote it: template int Class<int>::StaticMemberVariable; (that's an explicit instantiation), or simply instantiating the entire class and all it's parts: template class Class<int>; W. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ices.utexas.edu www: http://www.ices.utexas.edu/~bangerth/
next reply other threads:[~2003-04-04 20:26 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-04-04 20:26 Wolfgang Bangerth [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-04-07 14:20 bangerth 2003-04-04 20:16 Wolfgang Bangerth 2003-04-03 22:23 bangerth 2003-04-03 21:46 kilpatds
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=20030404202600.8540.qmail@sources.redhat.com \ --to=bangerth@ices.utexas.edu \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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: linkBe 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).