Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2003-07-30 08:24:00


John Maddock ha escrito:

> >Currently, BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
> >is not defined for gcc. However, the following URL in the gcc bug
> >database
> >
> >http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7676
> >
> >leads me to believe that the macro should be set on for the appropriate
> >versions of gcc. Matter of fact, I run with this problem myself and it
> >can be
> >workedaround with techniques similar to those employed for MSVC. See
> >for instance definitions of get() and workaround_holder in
> >
> >boost/tuple/detail/tuple_basic_no_partial_spec.hpp
> >
>
> Thanks,
>
> The issue with gcc seems to be a little more specific than we normally set
> the macro for, but I don't see any reason why we shouldn't set it. Am I
> right in thinking that this is specific to gcc 3.1 and 3.2? Also do you

So it seems from the bug report. I've checked the bug to be present
for gcc version 3.2 20020927 (prerelease) in cygwin. From some 3.2.x
version on the bug is reportedly fixed, but I couldn't determine the value of x.

>
> have a test case that can be added to the appropriate config test?

I've just written the following. It (correctly) fails for MSVC 6.5 and gcc 3.2 for
cygwin,
but I cannot test it in a conforming compiler.

Regards,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

******BEGIN CODE******
// (C) Copyright Joaquín M López Muñoz 2003. Permission to copy, use, modify,
// sell and distribute this software is granted provided this copyright notice
// appears in all copies. This software is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any purpose.

// MACRO: BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
// TITLE: explicit function template arguments
// DESCRIPTION: Member template functions not fully supported.

namespace boost_no_explicit_function_template_arguments{

#ifndef BOOST_NO_MEMBER_TEMPLATES

struct foo
{
  template<class T> int bar(){return 0;}
  template<int I> int bar(){return 1;}
};

int test_0()
{
  foo f;
  int a=f.template foo<char>();
  int b=f.template foo<2>();

  if(a!=0||b!=1)return -1;
  return 0;
}

#else

int test_0()
{
  return 0;
}

#endif

typedef char type_a;
struct type_b{char m[2];};

template <typename T> unsigned fox(){return (unsigned)sizeof(T);}

int test_1()
{
   unsigned a=fox<type_a>();
   unsigned b=fox<type_b>();

   if(a!=(unsigned)sizeof(type_a)||b!=(unsigned)sizeof(type_b))return -1;
   return 0;
}

int test()
{
  if(test_0()!=0)return -1;
  if(test_1()!=0)return -1;
  return 0;
}

}

******END CODE******


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk