public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Noel Yap <nyap@OLF.COM> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/5296: Pointers to functions and template functions behave differentl Date: Mon, 29 Apr 2002 14:16:00 -0000 [thread overview] Message-ID: <20020429211602.8068.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/5296; it has been noted by GNATS. From: Noel Yap <nyap@OLF.COM> To: "'wolfgang.bangerth@iwr.uni-heidelberg.de'" <wolfgang.bangerth@iwr.uni-heidelberg.de>, "'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>, "'gcc-prs@gcc.gnu.org'" <gcc-prs@gcc.gnu.org>, "'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>, "'nobody@gcc.gnu.org'" <nobody@gcc.gnu.org> Cc: Subject: Re: c++/5296: Pointers to functions and template functions behave differentl Date: Mon, 29 Apr 2002 17:14:30 -0400 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2653.12"> <TITLE>Re: c++/5296: Pointers to functions and template functions = behave differentl</TITLE> </HEAD> <BODY> <P><FONT SIZE=3D2 FACE=3D"Arial"><A = HREF=3D"http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=3Dview%20audit-trail&= database=3Dgcc&pr=3D5296" = TARGET=3D"_blank">http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=3Dview%20au= dit-trail&database=3Dgcc&pr=3D5296</A></FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Arial">I've found one or two (depending on if = you count them to be the same or not) workarounds for this:</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">1. original snippet:</FONT> <BR><FONT FACE=3D"Courier New">int main () {<BR> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 print_type (&pp1);<BR> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 print_type (&pp2<int>);<BR> =A0 =A0 =A0 =A0 =A0 =A0 = =A0};</FONT><FONT FACE=3D"Arial"> </FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Arial">workaround (note that reinterpret_cast = will NOT work here):</FONT> <BR><FONT FACE=3D"Courier New">int main () {<BR> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 print_type (&pp1);<BR> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 print_type ((void (*)(int)) &pp2<int>);<BR> =A0 =A0 =A0 =A0 =A0 =A0 = =A0};</FONT><FONT FACE=3D"Arial"> </FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Arial">2. original snippet:</FONT> <BR><FONT FACE=3D"Courier New">int main () {<BR> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 print_type (&pp1);<BR> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 print_type (&pp2<int>);<BR> =A0 =A0 =A0 =A0 =A0 =A0 = =A0};</FONT><FONT FACE=3D"Arial"> </FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Arial">workaround:</FONT> <BR><FONT FACE=3D"Courier New">int main () {</FONT> <BR> = = <FONT FACE=3D"Courier = New">void (*pp2p)(int) =3D &pp2<int>;</FONT> <BR> <BR><FONT FACE=3D"Courier New">=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 print_type (&pp1);<BR> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 print_type (pp2p);<BR> =A0 =A0 =A0 =A0 =A0 =A0 = =A0};</FONT><FONT FACE=3D"Arial"> </FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Arial">I think the fact that reinterpret_cast = has problems points to the fact that the compiler really doesn't know = what the type is (and hence, the {unknown_type} in the error = message).</FONT></P> <P><FONT SIZE=3D2 FACE=3D"Arial">Noel Yap</FONT> </P> <BR> <P><B><FONT SIZE=3D2 FACE=3D"Arial">=A9 2002 OpenLink Financial = </FONT></B> </P> <P><B><FONT SIZE=3D2 FACE=3D"Arial">Copyright in this message and any = attachments remains with us. It is</FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">confidential and may be legally = privileged. If this message is not </FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">intended for you it must not be = read, copied or used by you or </FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">disclosed to anyone = else. Please advise the sender immediately if </FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">you have received this message in = error.</FONT></B> </P> <P><B><FONT SIZE=3D2 FACE=3D"Arial">Although this message and any = attachments are believed to be free of </FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">any virus or other defect that = might affect any computer system into </FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">which it is received and opened, = it is the responsibility of the </FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">recipient to ensure that it is = virus free and no responsibility </FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">is accepted by Open Link = Financial, Inc. for any loss or damage in any </FONT></B> <BR><B><FONT SIZE=3D2 FACE=3D"Arial">way arising from its = use.</FONT></B> </P> <BR> </BODY> </HTML>
next reply other threads:[~2002-04-29 21:16 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-04-29 14:16 Noel Yap [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-04-26 5:32 nathan 2002-01-07 2:16 wolfgang.bangerth
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=20020429211602.8068.qmail@sources.redhat.com \ --to=nyap@olf.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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).