[wx-dev] [CVS HEAD] Compile error in include/wx/datetime.h

Wlodek Szafran wlodek.szafran at hwcn.org
Sun Apr 1 18:40:13 PDT 2007


On 04/01/2007 11:11 PM, Vaclav Slavik wrote:
> Hi,

Hello, Vaclav,

> Wlodek Szafran wrote:
>> $ i686-pc-mingw32-g++ --version
>> i686-pc-mingw32-g++ (GCC) 4.1.3 20070326 (prerelease)
> 
> Sorry, where did you get this version?

It obviously isn't an official release.  Built it myself from the most 
recent GCC weekly snapshot as a Cygwin-hosted, MinGW-targetting 
cross-compiler, for testing purposes.

> The last version at mingw.org that I could find is 3.4.5 and that
 > one works correctly and so does 3.4.1.

Actually, with MinGW 3.4.5, I'm getting the erroneous result as well:

$ mingw32-g++ --version
mingw32-g++ (GCC) 3.4.5 (mingw special)

/usr/local/src/wxwidgets/build-debug/bk-deps mingw32-g++ -c -o 
baselib_appbase.o  -D__WXMSW__     -I../src/tiff -I../src/jpeg 
-I../src/png -I../src/zlib  -I../src/regex -I../src/expat/lib 
-DwxUSE_GUI=0 -DwxUSE_BASE=1 -D_IODBC_ -D__WXDEBUG__ 
-I/usr/local/src/wxwidgets/build-debug/lib/wx/include/mingw32-msw-ansi-debug-static-2.9 
-I../include -mthreads -Wall -Wundef -Wno-ctor-dtor-privacy -g -O0 
-Wextra -pedantic -Wno-long-long ../src/common/appbase.cpp
In file included from ../include/wx/filename.h:28,
                  from ../src/common/appbase.cpp:41:
../include/wx/datetime.h: In member function `wxDateTime::WeekDay 
wxDateTime::Tm::GetWeekDay()':
../include/wx/datetime.h:458: error: ambiguous overload for 'operator==' 
in '((wxDateTime::Tm*)this)->wxDateTime::Tm::wday ==  Inv_WeekDay'


I believe the culprit here is this group (line 243 in unichar.h) of 
overloaded operators:

wxDEFINE_COMPARISONS(wint_t, const wxUniChar&, wxCMP_REVERSE)

due to wint_t and wxDateTime_t both being typed as short unsigned int. 
When the above line is commented out, or when wxDateTime_t is typedef'ed 
as unsigned int, everything compiles smoothly.

>> Same thing happens with GCC 4.2 and 4.3.
> 
> And neither of these is released in vanilla version yet, let alone 
> Mingw one...

Also from the weekly snapshots.  BTW, when 4.2 gets released by GCC, 
there should be a MinGW version released shortly after.

Best regards.

-- 
Wlodek Szafran




More information about the wx-dev mailing list