This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/5296: Pointers to functions and template functions behave differentl


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&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =A0 print_type (&amp;pp1);<BR>
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =A0 print_type (&amp;pp2&lt;int&gt;);<BR>
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =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&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =A0 print_type (&amp;pp1);<BR>
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =A0 print_type ((void (*)(int)) &amp;pp2&lt;int&gt;);<BR>
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =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&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =A0 print_type (&amp;pp1);<BR>
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =A0 print_type (&amp;pp2&lt;int&gt;);<BR>
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE=3D"Courier =
 New">void (*pp2p)(int) =3D &amp;pp2&lt;int&gt;;</FONT>
 <BR>
 <BR><FONT FACE=3D"Courier New">=A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0 print_type (&amp;pp1);<BR>
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =A0 print_type (pp2p);<BR>
 =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =A0&nbsp; =
 =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.&nbsp; It is</FONT></B>
 <BR><B><FONT SIZE=3D2 FACE=3D"Arial">confidential and may be legally =
 privileged.&nbsp;&nbsp; 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.&nbsp;&nbsp; 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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]