public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bkoz at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/30857] New: accepts both explicit instantiation and explicit specialization, duplicate explicit instantiations, etc.
Date: Mon, 19 Feb 2007 11:19:00 -0000 [thread overview]
Message-ID: <bug-30857-365@http.gcc.gnu.org/bugzilla/> (raw)
I thought g++ used to warn for this:
template <typename T>
class foo { };
template<> class foo<int> { };
template class foo<int>;
Where the error was something informative like "one may not explicitly
specialize and explicitly instantiate" blah blah blah
However, mainline currently does not do this.
>From 14.7
-5- No program shall explicitly instantiate any template more than once, both
explicitly instantiate and explicitly specialize a template, or specialize a
template more than once for a given set of template-arguments. An
implementation is not required to diagnose a violation of this rule.
So, this is not required by the standard. As a QoI issue, however, this would
be beneficial.
Here's why I wanted this: if one is doing API testing, and the API requires
explicit specializations, than one possible negative test is to explicitly
instantiate the required specialization and get an error.
Otherwise, I suppose another neg test is to redefine the specialization. This
is also not required to give an error, but current g++ does (redefinition
error).
Note also, no diagnostic for duplicate explicit instantiations:
template <typename T>
class foo { };
template class foo<int>;
template class foo<int>;
Either of these or all may be a warning regressions (if my mind is not playing
tricks on me.)
I have not tested with other compilers, or previous g++ versions.
Consistent behavior for all three cases would be appreciated.
--
Summary: accepts both explicit instantiation and explicit
specialization, duplicate explicit instantiations, etc.
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bkoz at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30857
next reply other threads:[~2007-02-19 11:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-19 11:19 bkoz at gcc dot gnu dot org [this message]
2007-03-09 4:20 ` [Bug c++/30857] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
2007-03-09 18:56 ` pinskia at gcc dot gnu dot org
2007-03-11 19:56 ` mmitchel at gcc dot gnu dot org
2007-09-23 19:50 ` simartin at gcc dot gnu dot org
2008-01-24 17:19 ` pcarlini at suse dot de
2008-01-24 17:26 ` bkoz at gcc dot gnu dot org
2008-01-24 18:43 ` pcarlini at suse dot de
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-30857-365@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).