From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 27 15:21:10 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 9F5A016A419 for ; Thu, 27 Dec 2007 15:21:10 +0000 (UTC) (envelope-from wundram@beenic.net) Received: from mail.beenic.net (mail.beenic.net [83.246.72.40]) by mx1.freebsd.org (Postfix) with ESMTP id 6808313C448 for ; Thu, 27 Dec 2007 15:21:10 +0000 (UTC) (envelope-from wundram@beenic.net) Received: from [192.168.1.32] (a89-182-22-99.net-htp.de [89.182.22.99]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.beenic.net (Postfix) with ESMTP id BDF9FA44529 for ; Thu, 27 Dec 2007 16:13:29 +0100 (CET) From: "Heiko Wundram (Beenic)" Organization: Beenic Networks GmbH To: freebsd-hackers@freebsd.org Date: Thu, 27 Dec 2007 16:21:11 +0100 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200712271621.12167.wundram@beenic.net> Subject: 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 15:21:10 -0000 Hey all! I'm currently trying to implement (and use) a C++ member function template,= =20 but GCC won't eat the code I feed it. The problem is most probably related to the fact that the group of member=20 functions is only discriminated by return type (i.e., the template paramete= r=20 defines the return type), not by parameter (which could be inferred). =46rom what I gather, the C++ spec should allow the following code to work = (the=20 following is simplified from what I have, but pretty much the same=20 syntactically): """ template class Test { public: template V test() throw() { // Some stuff. } }; template void test2() throw() { Test* x =3D new Test(); x->test(); delete x; } int main(int argc, char** argv) { test2(); } """ gcc doesn't compile this code, no matter what I try to change the x->test=20 expression to. It does compile the code if the type of x is not defined via= a=20 template parameter in test2. If this is against the specs, please tell me, otherwise, looking forward to= =20 any hints on what may cause this! =2D-=20 Heiko Wundram Product & Application Development =2D------------------------------------ Office Germany - EXPO PARK HANNOVER =20 Beenic Networks GmbH Mail=E4nder Stra=DFe 2 30539 Hannover =20 =46on +49 511 / 590 935 - 15 =46ax +49 511 / 590 935 - 29 Mobil +49 172 / 43 737 34 Mail wundram@beenic.net Beenic Networks GmbH =2D------------------------------------ Sitz der Gesellschaft: Hannover Gesch=E4ftsf=FChrer: Jorge Delgado Registernummer: HRB 61869 Registergericht: Amtsgericht Hannover