public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29252]  New: Strange "No matching function for call" compilation error with G++ 4.1
@ 2006-09-27 14:23 yuanfei8077 at gmail dot com
  2006-09-27 15:47 ` [Bug c++/29252] " bangerth at dealii dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: yuanfei8077 at gmail dot com @ 2006-09-27 14:23 UTC (permalink / raw)
  To: gcc-bugs

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 10), note that this issue can also be found at G++
3.2(UL1.0)

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


-- 
           Summary: Strange "No matching function for call" compilation
                    error with G++ 4.1
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yuanfei8077 at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29252


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/29252] Strange "No matching function for call" compilation error with G++ 4.1
  2006-09-27 14:23 [Bug c++/29252] New: Strange "No matching function for call" compilation error with G++ 4.1 yuanfei8077 at gmail dot com
@ 2006-09-27 15:47 ` bangerth at dealii dot org
  2006-09-28  1:50 ` yuanfei8077 at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2006-09-27 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at dealii dot org  2006-09-27 15:46 -------
You didn't show us the code that generated the problem. We can't do anything
without that. Please read
  http://gcc.gnu.org/bugs.html
for more information.

Best
  W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|UNCONFIRMED                 |WAITING
            Summary|Strange "No matching        |Strange "No matching
                   |function for call"          |function for call"
                   |compilation error with G++  |compilation error with G++
                   |4.1                         |4.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29252


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/29252] Strange "No matching function for call" compilation error with G++ 4.1
  2006-09-27 14:23 [Bug c++/29252] New: Strange "No matching function for call" compilation error with G++ 4.1 yuanfei8077 at gmail dot com
  2006-09-27 15:47 ` [Bug c++/29252] " bangerth at dealii dot org
@ 2006-09-28  1:50 ` yuanfei8077 at gmail dot com
  2006-09-28  1:52 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: yuanfei8077 at gmail dot com @ 2006-09-28  1:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from yuanfei8077 at gmail dot com  2006-09-28 01:50 -------
Hi,

For your convinence, the following is the reproduction code.

Many Thanks,
-Kelvin


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;
}


-- 

yuanfei8077 at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29252


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/29252] Strange "No matching function for call" compilation error with G++ 4.1
  2006-09-27 14:23 [Bug c++/29252] New: Strange "No matching function for call" compilation error with G++ 4.1 yuanfei8077 at gmail dot com
  2006-09-27 15:47 ` [Bug c++/29252] " bangerth at dealii dot org
  2006-09-28  1:50 ` yuanfei8077 at gmail dot com
@ 2006-09-28  1:52 ` pinskia at gcc dot gnu dot org
  2006-09-28  1:56 ` pinskia at gcc dot gnu dot org
  2006-09-28  6:06 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-28  1:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29252


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/29252] Strange "No matching function for call" compilation error with G++ 4.1
  2006-09-27 14:23 [Bug c++/29252] New: Strange "No matching function for call" compilation error with G++ 4.1 yuanfei8077 at gmail dot com
                   ` (2 preceding siblings ...)
  2006-09-28  1:52 ` pinskia at gcc dot gnu dot org
@ 2006-09-28  1:56 ` pinskia at gcc dot gnu dot org
  2006-09-28  6:06 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-28  1:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-09-28 01:56 -------
The error message is broken but this is invalid code as you cannot bind a
temporary to a reference argument.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29252


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/29252] Strange "No matching function for call" compilation error with G++ 4.1
  2006-09-27 14:23 [Bug c++/29252] New: Strange "No matching function for call" compilation error with G++ 4.1 yuanfei8077 at gmail dot com
                   ` (3 preceding siblings ...)
  2006-09-28  1:56 ` pinskia at gcc dot gnu dot org
@ 2006-09-28  6:06 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2006-09-28  6:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bangerth at dealii dot org  2006-09-28 06:06 -------
I think the error message is perfectly clear: it says that there is no
function
   foo (X)
but that there is a function that provides
   foo (X&)

We've gone through this many times that there is no way to say "see, you
try to bind an rvalue to a reference, this isn't working" because the
overload set of candidates may be larger than the single function above
and there is no way to guess what the user may mean.

So closing...

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29252


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-09-28  6:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-27 14:23 [Bug c++/29252] New: Strange "No matching function for call" compilation error with G++ 4.1 yuanfei8077 at gmail dot com
2006-09-27 15:47 ` [Bug c++/29252] " bangerth at dealii dot org
2006-09-28  1:50 ` yuanfei8077 at gmail dot com
2006-09-28  1:52 ` pinskia at gcc dot gnu dot org
2006-09-28  1:56 ` pinskia at gcc dot gnu dot org
2006-09-28  6:06 ` bangerth at dealii dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).