This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: void template argument
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: "ëÒÁ×ÞÅÎËÏ ð.ç." <kravchenko at land dot ru>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 06 Oct 2003 15:06:12 +0200
- Subject: Re: void template argument
- References: <200310061256.h96CuUwC076640@www2.hotbox.ru>
"ëÒÁ×ÞÅÎËÏ ð.ç." <kravchenko@land.ru> writes:
> #ifdef TEMPLATE
> template<class arg>
> class At {
> public:
> void a(arg) {cout << "a" << endl; }
> };
> typedef At<void> A;
> #else
> class A {
> public:
> void a(void) {cout << "a" << endl; }
> };
> #endif
>
> i've supposed that two banches (with and without
> -DTEMAPLTE) are identical. but gcc 2.95.3 & 3.2.3
> compilers fails compiling -DTEMPLATE with errors.
void a(void) does not declare a nameless parameter of type void, but
as a special case (inherited from C) declares a function without
parameters. Since this happens at the syntactic level, the same is
not true for a template argument.
--
Falk