|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-01-09 03:32:33
Hi.
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.
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.
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk