Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!nucsrl!tellab5!balr!clrcom!rmartin From: rmartin@clear.com (Bob Martin) Newsgroups: comp.lang.c++ Subject: Bug in Sun C++ 2.0 Message-ID: <1991Mar21.022309.15355@clear.com> Date: 21 Mar 91 02:23:09 GMT Organization: Clear Communications, Inc. Lines: 30 I have been having a problem with Sun C++ 2.0. I have a class in which I declare the following set of overloaded member functions: Add(int, ...); Add(long, ...); Add(double, ...); The compiler can disambiguate calls to the first two, but not to the third. If I scramble the order of the declarations, it is still the third declaration that cannot be disambiguated. For example: Add((int)1, 2, 2, 0); works just fine. and also..... Add((long)1, 2, 2, 0); also works fine. But.......... Add((double)1.2, 2, 2, 0); fails, with complaints that the call is ambiguous between Add(int, ...) and Add(long, ...). It furthermore says that a double has been converted to a int. When I run the program the Add(int, ...) is indeed called. If I alter the order of the declarations so that the Add(int, ...) is the last declaration, then it can disambiguate calls to Add(long, ...) and Add(double, ...), but not to Add(int, ...); Has anybody else seen this problem? Is there a workaround? -- +-Robert C. Martin-----+:RRR:::CCC:M:::::M:| Nobody is responsible for | | rmartin@clear.com |:R::R:C::::M:M:M:M:| my words but me. I want | | uunet!clrcom!rmartin |:RRR::C::::M::M::M:| all the credit, and all | +----------------------+:R::R::CCC:M:::::M:| the blame. So there. |