public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/13847] Additions to the changes.html file for 3.4. Date: Sun, 25 Jan 2004 16:50:00 -0000 [thread overview] Message-ID: <20040125165049.32298.qmail@sources.redhat.com> (raw) In-Reply-To: <20040124154329.13847.mattyt-bugzilla@tpg.com.au> ------- Additional Comments From giovannibajo at libero dot it 2004-01-25 16:50 ------- Befriending and explicitly instantiating typedefs won't work anymore. *********************************************************************** Yes, this could use a changes.html entry. In standardese, GCC 3.4.0 enforces the standard clause in [basic.lookup.elab]/2 and /3, which talks about elaborated-type-specifiers (ETS): "If the name lookup finds a typedef-name, the elaborated-type-specifier is ill-formed." An ETS is something of the form "class/struct/enum X;". ETS are mainly used for: - forward declarations (not affected by recent changes). - friend declarations. Given the bugfix above, GCC 3.4.0 doesn't allow anymore to befried a class through a typedef name: class A; typedef A B; class C { friend class B; // ERROR! It used to work. }; - Explicit instantiations. Again, you can't use typedef names anymore: template <int> class A {}; typedef A<0> B; template class B; // ERROR! It used to work. - As an additional note, ETS are also useful as a workaround if you have a both a type and a non-type entity bound to the same name. struct A {}; int A; void foo(void) { A = 0; // OK A a; // ERROR, lookup finds "int A" struct A a; // OK, lookup of ETS always finds "struct A". } Need a "template <>" before templated static variable definitions. ****************************************************************** This is already documented in changes.html. The available function overloadings from a call in a template is determined at definition time not instantiation time, except for Koenig lookup. ****************************************************************************** Ok. I would just say that, in templates, all (modulo bugs) unqualified names are now looked up in at definition time. This can be added as a rework of the third C++ entry in changes.html. An example code could be: void foo(int); template <int> struct A { static void bar(void){ foo('a'); } }; void foo(char); int main() { A<0>::bar(); // Calls foo(int), used to call foo(char). } You need to put "class" on explicit instantiations of classes, ie no "template A<B>;" ****************************************************************************** I didn't even know this was allowed before, must have been a GCC extension. OK, we can add a entry for this as well. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13847
next prev parent reply other threads:[~2004-01-25 16:50 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-01-24 15:43 [Bug c++/13847] New: " mattyt-bugzilla at tpg dot com dot au 2004-01-24 15:47 ` [Bug c++/13847] " pinskia at gcc dot gnu dot org 2004-01-25 16:50 ` giovannibajo at libero dot it [this message] 2004-01-25 16:52 ` giovannibajo at libero dot it 2004-01-26 14:34 ` mattyt-bugzilla at tpg dot com dot au 2004-02-05 14:53 ` giovannibajo at libero dot it 2004-02-05 20:04 ` reichelt at gcc dot gnu dot org 2004-02-08 20:46 ` giovannibajo at libero dot it 2004-02-09 14:06 ` giovannibajo at libero dot it
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=20040125165049.32298.qmail@sources.redhat.com \ --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: 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).