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:16:00 -0000 [thread overview] Message-ID: <20030404201600.7379.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: gcc-gnats@gcc.gnu.org Cc: Subject: Re: c++/10307: constructor for static object of template omitted Date: Fri, 4 Apr 2003 14:12:44 -0600 (CST) ---------- Forwarded message ---------- Date: Thu, 3 Apr 2003 23:11:31 -0500 From: Douglas Kilpatrick <kilpatds@oppositelock.org> To: bangerth@dealii.org Subject: Re: c++/10307: constructor for static object of template omitted On 3 Apr 2003 22:23:55 -0000 bangerth@dealii.org wrote: > I think this is actually what the standard prescribes, > since static variables are only instantiated by use or > by explicit instantiation, not by instantiation of > the class they belong to. In fact, you can make the above > code work as you expect it by adding this line: > template TemplateStatic Template<int>::s; Ok. Question for you then... The actual place I ran into this was a plugin framework, trying to eliminate some of the cookie-cutter code. I have a base class that is the plugin interface. I want to create a intermediate class that the user of the framework subclasses that handles registering the plugin and factory method on library load (dlopen()). Then the user subclasses from that. 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. 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) Or is this simply a case of "Don't Do That Then."? :) Doug -- Doug Kilpatrick kilpatds@oppositelock.org
next reply other threads:[~2003-04-04 20:16 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-04-04 20:16 Wolfgang Bangerth [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-04-07 14:20 bangerth 2003-04-04 20:26 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=20030404201600.7379.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).