www.digitalmars.com         C & C++   DMDScript  

c++.beta - possible dmc ambiguity bug ?

Here is a dmc bug reduced from wxBoxSizer code; in AMethod, removing the 
const before wxSize allows the code to compile
chris

C:\wx\wxwidgets\build\msw>dmc -mn -c -cpp -osize.obj -g -o+none size.cpp
size.cpp(25) : Error: ambiguous reference to symbol
Had: wxBoxSizer::SizeInMajorDir(const wxSize&)const
and: wxBoxSizer::SizeInMajorDir(wxSize&)
--- errorlevel 1

#define wxHORIZONTAL 1

class wxSize
{
public:
     int x, y ;
};

class wxBoxSizer
{
protected:
     int SizeInMajorDir(const wxSize& sz) const
     {
         return m_orient == wxHORIZONTAL ? sz.x : sz.y;
     }

     int& SizeInMajorDir(wxSize& sz)
     {
         return m_orient == wxHORIZONTAL ? sz.x : sz.y;
     }

     int AMethod ()
     {
	const wxSize sizeThis ;
	return SizeInMajorDir(sizeThis);
     }

     int m_orient ;
} ;
Oct 27 2007