This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange "No matching function for call" compilation error with G++ 4.1


Hi there,

Just resend this letter again with adding reproduction code.  Any
comments/suggestions are higly appreciated.

I am porting some code to SUSE 10, with G++ 4.1. And hit an strange
"no matching function call" compilation error.  I am confused because
the calling function and candidate are nearly 100% same.

I wonder if this is a known G++ limitation or issue ? Because the same
program got compiled with VC8.

Below is the compilation environment info and compilation error.

env info
=========
g++ (GCC) 4.1.0  (SLES10), can also be found with g++ 3.2 (UL1.0)

No compile option is added


Compilation error ================= no matching function for call to tdat_hash_map<MemAllocator<int>
::func(MemAllocator<int>)

main.cpp:6: note: candidates are: static void tdat_hash_map<_AllocType>::func(_AllocType&) [with _AllocType = MemAllocator<int>]


Repro code =========== template <class Type> class MemAllocator{};

template <class _AllocType> class tdat_hash_map {
public:
	typedef _AllocType _Alloc;
	static void func(_Alloc&) {};
};

int main()
{
	typedef tdat_hash_map<MemAllocator<int> > Map;
	Map::func((MemAllocator<int>) (MemAllocator<int>()));

	return 0;
}




Thanks, -Kelvin


On 9/27/06, Yuanfei guo <yuanfei8077@gmail.com> wrote:
Hi there,

I am porting some code to SUSE 10, with G++ 4.1. And hit an strange
"no matching function call" compilation error.  I am confused because
the calling function and candidate are nearly 100% same.

I wonder if this is a known G++ limitation or issue ? Because the same
program got compiled with VC8.

Below is the compilation environment info and compilation error.

 env info
=========
g++ (GCC) 4.1.0  (SUSE Linux)

No compile option is added


Compilation error ============== ./Cache/CacheManager.h:424: error: no matching function for call to tdat_hash_map<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, Element<unsigned int, SqlObjectDefn, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >*, MemAllocator<std::pair<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, Element<unsigned int, SqlObjectDefn, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >*> > >::tdat_hash_map1(MemAllocator<std::pair<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, Element<unsigned int, SqlObjectDefn, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >*> >, int)

./Common/TdatHashMap.h:250: note: candidates are: static void
tdat_hash_map<_Key, _Tp, _AllocType>::tdat_hash_map1(_AllocType&, int)
[with _Key = std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >, _Tp = Element<unsigned int, SqlObjectDefn,
std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> > >*, _AllocType =
MemAllocator<std::pair<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >, Element<unsigned
int, SqlObjectDefn, std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >*> >]



Any comments/suggestions are higly appreciated.

Thanks,
-Kelvin



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]