public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "potswa at mac dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53251] New: template keyword ignored between -> and member under name collision with non-member Date: Sun, 06 May 2012 01:05:00 -0000 [thread overview] Message-ID: <bug-53251-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53251 Bug #: 53251 Summary: template keyword ignored between -> and member under name collision with non-member Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: potswa@mac.com Minimal testcase: template< typename > class set; template< typename > struct b { template<typename T> void set(); }; template<typename T> struct d : b<T> { d() { this->template set<int>(); } }; int main() { d<int> s; } Diagnostic: In constructor ‘d<T>::d()’: 12:17: error: invalid use of ‘class set<int>’ The name "set" is looked up in the context of the expression, outside the class, perhaps per §3.4.5/1 [basic.lookup.classref]. Furthermore, a class found by lookup in expression scope per 3.4.5/1 must agree with lookup in class scope anyway (i.e. it must be a base class if class scope lookup succeeds) or the program is ill-formed. 3.4.5/1 does not apply because the template keyword is used to mark a dependent object expression. I suspect that somehow the hint carried by the keyword isn't properly restricting name lookup. For deeper discussion see http://stackoverflow.com/questions/10426428 .
next reply other threads:[~2012-05-06 0:51 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-05-06 1:05 potswa at mac dot com [this message] 2012-05-06 1:06 ` [Bug c++/53251] " pinskia at gcc dot gnu.org 2012-05-06 1:11 ` pinskia at gcc dot gnu.org 2021-08-04 6:27 ` pinskia at gcc dot gnu.org 2024-04-06 22:49 ` pinskia at gcc dot gnu.org
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-53251-4@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: 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).