From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 27 21:36:06 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B0ED16A418 for ; Thu, 27 Dec 2007 21:36:06 +0000 (UTC) (envelope-from V.Haisman@sh.cvut.cz) Received: from service2.sh.cvut.cz (service2.sh.cvut.cz [IPv6:2001:718:2:0:217:a4ff:fe3f:b3d4]) by mx1.freebsd.org (Postfix) with ESMTP id BB9DE13C467 for ; Thu, 27 Dec 2007 21:36:05 +0000 (UTC) (envelope-from V.Haisman@sh.cvut.cz) Received: from localhost (localhost [127.0.0.1]) by service2.sh.cvut.cz (Postfix) with ESMTP id B3F28138563; Thu, 27 Dec 2007 22:36:04 +0100 (CET) Received: from service2.sh.cvut.cz ([127.0.0.1]) by localhost (service2.sh.cvut.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 16615-09; Thu, 27 Dec 2007 22:35:58 +0100 (CET) Received: from logout.sh.cvut.cz (logout.sh.cvut.cz [147.32.127.203]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by service2.sh.cvut.cz (Postfix) with ESMTP id 4DC7A138567; Thu, 27 Dec 2007 22:35:58 +0100 (CET) Received: from [192.168.1.2] (localhost [127.0.0.1]) by logout.sh.cvut.cz (Postfix) with ESMTP id D21A761C25; Thu, 27 Dec 2007 22:35:22 +0100 (CET) Message-ID: <47741A91.1030001@sh.cvut.cz> Date: Thu, 27 Dec 2007 22:35:13 +0100 From: =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: "Heiko Wundram (Beenic)" References: <200712271621.12167.wundram@beenic.net> In-Reply-To: <200712271621.12167.wundram@beenic.net> X-Enigmail-Version: 0.95.5 OpenPGP: id=1204AF05; url=http://logout.sh.cvut.cz/~wilx/Vaclav_Haisman_(0x63B6B297)_pub.asc Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEUnMzWJm5S+0864pn5r blp/hnW2up7X7uqftbNRVUrW1LGBdGfHwJqPi3ScoYtBQzhDxGEwAAAAB3RJTUUH1QoQDDgyQtx8 HQAAAkNJREFUeJzFU0toU0EUPYu66CpGdCUUmoUJkpUDQUoNBVEUrBJsq1Ki2EIKIUZ8mydBhYi0 wVUXJVCLCrFN4DIEQdxIqdBIFsMkWD9YJClCRGKjJaviynjfe8RPogtXPcObuXPOPXd+PHj+Aeyo QNmobGLXVeANGM+GsP0B2yqHHNVoCD2LwLglVGZx7yXSlADR0uZu9C4Bpy3hUxPvH/cuUw6UoPCL h64I8KAJuMpwRU8uUMJy0OIpHVeXmulZoCc/t0LlTbJLEY1EudPRcnVjgAP5Osdl4K5HVP4+2bAI okaUA0Iq6Q59+Zy2eMWN6EpFTsa3+uD1+JKj4TPHuYTSMaLScLAaqk94YJqG4ds30hojOVgYoNJc NTztNU2TBYbhu9Aafnq08ORja37da1NwBrN/b7NVEc+b8yecuYkp08vNvLYneVZRaSH1vS0UnfHm OUPzWaZufHPmCWSdWrfeGVQQKmcsO4If8pAdXJ/xF4QQAeOVY1AQQcfirwkLUWeWVTgi6vaGt2xe BGzBEIMQorru8RxgPqY1V6uxYnwVBRZEI1ytCm3dE8mC2DgcbzCJGHdBEVDKuWDSwsrSGoqzJmNt 2jJpNueIH0qS8/0JrDKnVBdvOzIsdVr4zaX9dn9xcLLKdCtQGfutVacLE9Ja+yfbDvO4aMWrklfK /JYv15C8Kw9S10kup5Bys0N1bLdcn4HvTl/Xlh6Fpllwj5/XpH9BUXn/ym0Dvv7Rt2MywojpYiSi i7Hsscaa19zZ//y/hR+BT/ns80nmJAAAAABJRU5ErkJggg== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigDD6F5C1BFAF9589872041ECF" X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at service2.sh.cvut.cz X-Spam-Status: No, hits=-1.4 tagged_above=-255.0 required=5.0 tests=AWL, CRM114_HAM_50, JR_RCVD_HOST_PROBS1, JR_RCVD_TOO_FEW_HOPS X-Spam-Level: Cc: freebsd-hackers@freebsd.org Subject: Re: OT: C++ Template Functions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Dec 2007 21:36:06 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDD6F5C1BFAF9589872041ECF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Heiko Wundram (Beenic) wrote, On 27.12.2007 16:21: > Hey all! >=20 > I'm currently trying to implement (and use) a C++ member function templ= ate,=20 > but GCC won't eat the code I feed it. >=20 > The problem is most probably related to the fact that the group of memb= er=20 > functions is only discriminated by return type (i.e., the template para= meter=20 > defines the return type), not by parameter (which could be inferred). >=20 > From what I gather, the C++ spec should allow the following code to wor= k (the=20 > following is simplified from what I have, but pretty much the same=20 > syntactically): >=20 > """ > template > class Test > { >=20 > public: >=20 > template > V test() > throw() > { > // Some stuff. > } >=20 > }; >=20 > template > void test2() > throw() > { > Test* x =3D new Test(); > x->test(); Change this to x->template test(); For explanation see 14.2/4 of the y= ear 2003 revision of the standard. > delete x; > } >=20 > int main(int argc, char** argv) > { > test2(); > } > """ >=20 > gcc doesn't compile this code, no matter what I try to change the x->te= st=20 > expression to. It does compile the code if the type of x is not defined= via a=20 > template parameter in test2. >=20 > If this is against the specs, please tell me, otherwise, looking forwar= d to=20 > any hints on what may cause this! >=20 -- VH --------------enigDD6F5C1BFAF9589872041ECF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHdBqYoUFWwtEPkHIRCIG8AJwJm+dnyWTwSLRNgt58iJIPcOGGTwCfTPLW StST+Ij37yYNJ6A8rCL4x6M= =zipN -----END PGP SIGNATURE----- --------------enigDD6F5C1BFAF9589872041ECF--