From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31497 invoked by alias); 21 Sep 2011 08:15:41 -0000 Received: (qmail 31284 invoked by uid 22791); 21 Sep 2011 08:15:38 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gw0-f47.google.com (HELO mail-gw0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Sep 2011 08:15:14 +0000 Received: by gwaa2 with SMTP id a2so1298988gwa.20 for ; Wed, 21 Sep 2011 01:15:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.6.195 with SMTP id d3mr1088097pba.130.1316592913251; Wed, 21 Sep 2011 01:15:13 -0700 (PDT) Received: by 10.143.162.14 with HTTP; Wed, 21 Sep 2011 01:15:13 -0700 (PDT) In-Reply-To: <32503711.post@talk.nabble.com> References: <32503711.post@talk.nabble.com> Date: Wed, 21 Sep 2011 08:15:00 -0000 Message-ID: Subject: Re: Template specialization error for "void" template parameter in GCC From: Jonathan Wakely To: "himanshu.gupta" Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00170.txt.bz2 On 21 September 2011 06:21, himanshu.gupta wrote: > > Hi, > > The following code is giving errors while compiling with GCC 4.5. > > Foo.h Header File: declaration of template class. > template > class Foo > { > =A0 =A0void FooBar() const; > }; > > Foo.cpp Source File: explicit definitions for member function of template > class Foo. > template<> > void Foo::FooBar () const > { > =A0 =A0do something... > } > > The above explicit function declaration for "void" is giving error... > error: template-id 'type<>' for 'void Foo::FooBar() const' does not > match any template declaration > > The same explicit function declarations with other types - int, unsigned > int, etc. compiles successfully. The explicit specialization for "void" > however seems to only compile without template<> being added. But I belie= ve > as per GCC they do require template<>. > > Is it an error with GCC for "void" template parameter? Or am I missing > something with syntax/ GCC compile option? It looks as though you've forgotten to #include "Foo.h"