public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gianni at mariani dot ws" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/15480] New: ICE with sizeof(T().f()) as template parameter in function resolution Date: Mon, 17 May 2004 08:02:00 -0000 [thread overview] Message-ID: <20040516212738.15480.gianni@mariani.ws> (raw) Below is a template that is supposed to discover wether a type contains a method named "Function". Comeau compiles this fine on Comeau C/C++ 4.3.3, fails on MSC++ 7.1 with what seems to be the wrong error and ICE's on gcc 3.4.0. typedef char MPT_False; struct MPT_True { int m[2]; }; template <unsigned int w_siz> struct MPT_IntToType { typedef char type[ w_siz ]; }; template <typename w_D> struct MPT_Finder_Member { template <typename w_T> static MPT_True finder( const w_T *, typename MPT_IntToType< sizeof(w_T().Function()) // sizeof(static_cast<w_T>(0)->Function()) //fails same way >::type * = 0 ); static MPT_False finder( const w_D * ); }; template <typename w_D > struct MPT_ContainsFuncMember { struct DerivedClass : w_D { }; typedef DerivedClass * DerivedClassp; enum { value = ( sizeof( MPT_Finder_Member<w_D>::finder( DerivedClassp() ) ) == sizeof( MPT_True ) ) }; }; struct A { }; struct B { int Function(); }; #include <iostream> int main() { std::cout << MPT_ContainsFuncMember<A>::value << "\n"; std::cout << MPT_ContainsFuncMember<B>::value << "\n"; } -- Summary: ICE with sizeof(T().f()) as template parameter in function resolution Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gianni at mariani dot ws CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i386-redhat-linux GCC host triplet: i386-redhat-linux GCC target triplet: i386-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15480
next reply other threads:[~2004-05-16 21:27 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-05-17 8:02 gianni at mariani dot ws [this message] 2004-05-17 8:10 ` [Bug c++/15480] " gianni at mariani dot ws 2004-05-17 8:28 ` pinskia at gcc dot gnu dot org 2004-05-17 14:36 ` giovannibajo at libero dot it 2004-05-17 15:33 ` pinskia at gcc dot gnu dot org 2004-05-17 19:16 ` bangerth at dealii dot org 2004-05-17 19:16 ` gianni at mariani dot ws 2004-05-17 19:32 ` gianni at mariani dot ws 2005-01-06 2:01 ` pinskia at gcc dot gnu dot 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=20040516212738.15480.gianni@mariani.ws \ --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).