Boost logo

Boost :

From: John Maddock (jm_at_[hidden])
Date: 2003-01-09 06:40:29


> While working on the lexical_cast proposition, I found that the following
> code works on Comeau C++, GCC 3.2 and Borland C++ Builder 6.0, but fails
on
> Intel C++ 7.0, in strict mode:
>
> #include <string>
>
> template<class Result,class T>
> void f(Result,T) {}
>
> template<class Result,class CharType,class CharTraits,class Allocator>
> void f(Result,std::basic_string<CharType,CharTraits,Allocator>) {}
>
> template<class CharType,class CharTraits,class Allocator,class Source>
> void f(std::basic_string<CharType,CharTraits,Allocator>,Source) {}
>
> void f(std::string,std::string) {} // Error here
>
> int main()
> {
> int i;
> std::string str;
>
> f(i,i);
> f(str,i);
> f(i,str);
> f(str,str);
> }
>
> This gives the error:
>
> error: ambiguous guiding declaration -- more than one function template "f
> [with Result=_STL::string, CharType=char,
> CharTraits=_STL::char_traits<char>, Allocator=_STL::allocator<char>]"
> matches type "void (_STL::string, _STL::string)"
> void f(std::string,std::string) {}
> ^
>
> I've filed a problem report with Intel about this. Maybe we could get a
> configuration macro for this, to be set for Intel C++? The same error also
> occurs for version 6.0.
>
> If ok, I can submit a proper test file for Boost.Config. This appears
pretty
> compiler-specific, so maybe something like BOOST_INTEL_OVERLOAD_BUG could
be
> used.

If it is that compiler specific, and is only effecting one library, then why
not use BOOST_WORKAROUND ?

> Also, while we're at it, as Dave Abrahams notes in
> boost/config/compiler/intel.hpp, there is a difference between version 5.0
> and 6.0, in that the latter supports template template arguments, while
the
> former does not, so it should probably set BOOST_NO_TEMPLATE_TEMPLATES for
> versions prior to 6.0.

I'm hoping that the section:

#if (__EDG_VERSION__ <= 244) && !defined(BOOST_NO_TEMPLATE_TEMPLATES)
# define BOOST_NO_TEMPLATE_TEMPLATES
#endif

in common_edg.hpp does that ?

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


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