public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "Fetrovsky at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/51048] New: Class template inheritance doesn't work well with function-local types Date: Wed, 09 Nov 2011 06:42:00 -0000 [thread overview] Message-ID: <bug-51048-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51048 Bug #: 51048 Summary: Class template inheritance doesn't work well with function-local types Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: Fetrovsky@gmail.com #include <vector> template<typename X> struct A { X x; virtual X const& Push(X const& x) = 0; template<typename Y> X const& Push(Y const& y) { for (std::size_t i = 0; i < y.size(); ++i) Push(y[i]); } }; template<typename X> struct B: A<X> { using A<X>::Push; virtual X const& Push(X const& x) { return A<X>::x = x; } }; int F() { enum S { x, y }; return B<S>().Push(std::vector<S>(3, x)); } int main() { return F(); } I get the following: prog.cpp:7:23: error: 'const X& A<X>::Push(const X&) [with X = F()::S]', declared using local type 'const F()::S', is used but never defined If I take S out of F() and define it in the global namespace, it works fine.
next reply other threads:[~2011-11-09 6:23 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-11-09 6:42 Fetrovsky at gmail dot com [this message] 2011-11-09 12:38 ` [Bug c++/51048] " daniel.kruegler at googlemail dot com 2013-07-30 22:55 ` paolo.carlini at oracle dot com 2013-09-28 15:08 ` cameron314 at gmail dot com 2013-09-28 15:10 ` cameron314 at gmail dot com 2015-06-15 11:16 ` paolo.carlini at oracle dot com 2015-06-15 12:01 ` paolo.carlini at oracle dot com 2015-06-15 19:27 ` paolo at gcc dot gnu.org 2015-10-12 13:16 ` paolo at gcc dot gnu.org 2015-10-12 13:17 ` paolo.carlini at oracle dot com
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-51048-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).