[Bug c++/41508] New: error: no matching function for call to ...

mwarshofsk at aol dot com gcc-bugzilla@gcc.gnu.org
Tue Sep 29 18:50:00 GMT 2009


I am currently porting an app from Sun Solaris where we use the Solaris cc
compiler (version 5.8). Have a 12 year old legacy app that compiles "fine" in
the current environment :-)

While trying to migrate to RedHat Linux and the GNU g++ compiler (version
4.1.2) I am repeatedly running into "error: no matching function for call to
..." errors with code that sends and/or receives reference parameters.

Here's an example of the compiler error:

EJPeriod.C:102: error: no matching function for call to
âEJPeriod::EJPeriod(Date&, Date&, String)â
EJPeriod.h:83: note: candidates are: EJPeriod::EJPeriod(EJPeriod&)
EJPeriod.h:76: note:                 EJPeriod::EJPeriod()
EJPeriod.h:72: note:                 EJPeriod::EJPeriod(Date, Date, String&)

I don't understand why the compiler doesn't recognize the 3rd constructor
referenced by line 72. When I try to overload the constructor to satisfy the
compiler complaint the compiler correctly tells me the two constructors create
an ambiguous situation. Can you advise as to whether this is a compiler bug or
a potentially old coding standard that isn't acceptable with the version of the
GNU compiler we are using?

Also, this only seems to occur with our "home grown" classes. The compiler has
no issue with basic scalar types and the passing and receiving of reference and
non-reference parameters.

Lastly and admittedly, when I create a simple test.C program to duplicate the
issue the simple example compiles. There must be something else in the 1000s of
lines of code that I am overlooking.

Thanks in advance for any help or direction you can provide.

Regards,
Marc


-- 
           Summary: error: no matching function for call to ...
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mwarshofsk at aol dot com


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



More information about the Gcc-bugs mailing list