public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "fpelliccioni at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53236] using declaration and base function template overloading Date: Mon, 07 May 2012 13:27:00 -0000 [thread overview] Message-ID: <bug-53236-4-mc5r2D614c@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-53236-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53236 --- Comment #8 from Fernando Pelliccioni <fpelliccioni at gmail dot com> 2012-05-07 13:24:02 UTC --- Sorry, the comments were wrong. Here the corrected code with proper comments. Tested with GCC 4.7.1 and GCC 4.6.3 // g++ -std=c++0x gcc_error_simple.cpp // g++ -DWITH_USING_DECLARATION -std=c++0x gcc_error_simple.cpp #include <type_traits> template <typename T> struct Base { template <typename T2> typename std::enable_if<std::is_same<T, T2>::value, T>::type get() { return T2(); } }; template <typename T> struct Derived : Base<int> { typedef Base<int> base; #ifdef WITH_USING_DECLARATION using base::get; #endif template <typename T2> typename std::enable_if<std::is_same<T, T2>::value, T>::type get() { return T2(); } }; int main( /* int argc, char* argv[] */ ) { Derived<double> d; auto xxx = d.get<double>(); auto yyy = d.get<int>(); // #ifndef WITH_USING_DECLARATION -> Compile-time error -> GCC is behaving Correctly!!! Base<int>::get<int>() is hidden! // #ifdef WITH_USING_DECLARATION -> No Compile-time error -> GCC is behaving incorrectly. Base<int>::get<int>() must be hidden. return 0; }
next prev parent reply other threads:[~2012-05-07 13:24 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-05-04 18:59 [Bug c++/53236] New: " fpelliccioni at gmail dot com 2012-05-05 17:41 ` [Bug c++/53236] " daniel.kruegler at googlemail dot com 2012-05-05 18:14 ` fabien at gcc dot gnu.org 2012-05-05 19:17 ` daniel.kruegler at googlemail dot com 2012-05-05 22:00 ` fpelliccioni at gmail dot com 2012-05-05 22:01 ` fpelliccioni at gmail dot com 2012-05-05 22:17 ` fpelliccioni at gmail dot com 2012-05-06 17:55 ` daniel.kruegler at googlemail dot com 2012-05-07 13:27 ` fpelliccioni at gmail dot com [this message] 2012-05-07 13:51 ` daniel.kruegler at googlemail dot com 2012-05-07 14:00 ` fpelliccioni at gmail 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-53236-4-mc5r2D614c@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).