From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15483 invoked by alias); 21 Sep 2011 05:23:12 -0000 Received: (qmail 15473 invoked by uid 22791); 21 Sep 2011 05:23:10 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from sam.nabble.com (HELO sam.nabble.com) (216.139.236.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Sep 2011 05:22:57 +0000 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1R6FGq-0007oR-Kn for gcc-help@gcc.gnu.org; Tue, 20 Sep 2011 22:22:56 -0700 Message-ID: <32503712.post@talk.nabble.com> Date: Wed, 21 Sep 2011 05:23:00 -0000 From: "himanshu.gupta" To: gcc-help@gcc.gnu.org Subject: Explicity template specialization issue MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00166.txt.bz2 Hi, The following code is giving errors while compiling with GCC 4.5. Header File: declaration of template class. namespace public { template class Z { }; //Z template class X { protected: template class Y: public Z { void MyFunc( X& base ) { do somthing...; } }; //Y // Explicit specialization for "void" class. template<> class Y: public Z { void MyFunc( X& base ) { do somthing else...; } }; //Y explicit specialization template friend class Y; }; //X } // public The above explicit inner class declaration for "void" is giving errors... Errors for the line after the code comment of Explicity specialization): error: explicit specialization in non-namespace scope 'class public::X' error: 'ABC' Error for line with friend class declaratoin: error: too many template-parameter-lists The written code was very old and it has been compiled under Linux in the past. I'm wondering if an older version of GCC supported this, or whether it is GCC supported extension that can be switched on to compile it successfully. Did anyone has faced the similar issue? Could you please guide me how can I resolve this? Is there any compiler option that still allows to work this syntax? Note that the C++ standard says you cannot specialise the inner template without specialising the outer template. But I can not declare/define inner template class Y outside as it is using the outer template class parameter for the function. -- View this message in context: http://old.nabble.com/Explicity-template-specialization-issue-tp32503712p32503712.html Sent from the gcc - Help mailing list archive at Nabble.com.