www.digitalmars.com         C & C++   DMDScript  

c++.wxwindows - Possibility of the bug

reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
Hi!

We had added recently some new code within wxWidgets CVS which I found to 
cause error with (and only with) DMC. It was little discuted in wx-dev 
mailing list and there is suspicion that there is bug in DMC but I'm not 
enough skilled to seriously confirm that myself and it is very hard to 
debug it down to minimal code to duplicate it trimming wxWidgets class by 
class so I post here in case anyone could give us a hand here. The thread 
about the error is available at:

  http://lists.wxwidgets.org/cgi-bin/ezmlm-cgi?5:sss:55259

I myself made a "-l -e" listing of the code so can provide it if 
it would be necessary and helpful.  It's 4.729.824 bytes long (which is 
hardly minimal sample :-( ). The test and wxWidgets was build with command:

smake /NOLOGO /F makefile.dms SHARED=0 RUNTIME_LIBS=static UNICODE=0 
MONOLITHIC=1 BUILD=release USE_GUI=1 USE_OPENGL=0 USE_ODBC=0 WXUNIV=0

Thanks in advance for any help.

ABX
Dec 07 2004
next sibling parent Arjan Knepper <arjan ask.me> writes:
I don't make a promise, but I will look into it as soon as possible.
Might take a while I'm very very busy right now.

Arjan

W這dzimierz Skiba wrote:
 Hi!
 
 We had added recently some new code within wxWidgets CVS which I found to 
 cause error with (and only with) DMC. It was little discuted in wx-dev 
 mailing list and there is suspicion that there is bug in DMC but I'm not 
 enough skilled to seriously confirm that myself and it is very hard to 
 debug it down to minimal code to duplicate it trimming wxWidgets class by 
 class so I post here in case anyone could give us a hand here. The thread 
 about the error is available at:
 
   http://lists.wxwidgets.org/cgi-bin/ezmlm-cgi?5:sss:55259
 
 I myself made a "-l -e" listing of the code so can provide it if 
 it would be necessary and helpful.  It's 4.729.824 bytes long (which is 
 hardly minimal sample :-( ). The test and wxWidgets was build with command:
 
 smake /NOLOGO /F makefile.dms SHARED=0 RUNTIME_LIBS=static UNICODE=0 
 MONOLITHIC=1 BUILD=release USE_GUI=1 USE_OPENGL=0 USE_ODBC=0 WXUNIV=0
 
 Thanks in advance for any help.
 
 ABX

Dec 07 2004
prev sibling parent reply Mike Wetherell <mike.wetherell ntlworld.com> writes:
Hi,

I'm reposting this since it didn't seem to get though, so appolgies if we 
end up with two copies.

ABX, I've prepared a minimal example, does this demonstrate
the problem on your machine too, I think maybe you are
using a newer version than me?

-------------------------------------------------------
Y:\>r:\dm\bin\dmc | head -1
Digital Mars Compiler Version 8.38n

Y:\>type mini.cpp
#include <stdio.h>
#define _T(x) x
typedef char wxChar;

class wxFile
{
public:
    wxFile(const wxChar*) { printf("wxFile\n"); }
};

class wxString
{
public:
    wxString(const wxChar*) { printf("wxString\n"); }
    operator const wxChar*() const { return _T(""); }
};

class wxFileInputStream
{
public:
    wxFileInputStream(const wxString&) { }
    wxFileInputStream(wxFile&) { }
};

int main()
{
    wxFileInputStream *p = new wxFileInputStream(_T("mytext.dat"));
    delete p;
    return 0;
}


Y:\>r:\dm\bin\dmc mini.cpp
    wxFileInputStream *p = new wxFileInputStream(_T("mytext.dat"));
                                                                  ^
mini.cpp(27) : Warning 11: non-const reference initialized to temporary
link mini,,,user32+kernel32/noi;


Y:\>mini
wxFile

Y:\>
-------------------------------------------------------

I hope this is helpful.
Regards,
Mike
Dec 07 2004
next sibling parent reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
Mike Wetherell <mike.wetherell ntlworld.com> wrote in
news:cp5dlq$2p1m$1 digitaldaemon.com: 
 ABX, I've prepared a minimal example, does this demonstrate
 the problem on your machine too

Yes, indeed, thanks! I pasted your minimal sample into our tests/streams/datastreamtest.cpp and run it through our building process. The error was: wxFileInputStream *p = new wxFileInputStream(_T("mytext.dat")); ^ streams\datastreamtest.cpp(27) : Error: reference must refer to same type or be const Had: char * and: wxFile&
 I think maybe you are
 using a newer version than me?

I used latests DMC beta.
 Y:\>r:\dm\bin\dmc mini.cpp

Perhaps the problems is in one of the compiler flags? Complete command line wxWidgets/bakefile generated was: dmc -mn -c -odmc_msw\test_datastreamtest.obj -o -D__WXMSW__ -I.\..\include -I.\..\lib\dmc_lib\msw -w- -I. -Ar -Ae .\streams\datastreamtest.cpp ABX
Dec 08 2004
next sibling parent Mike Wetherell <mike.wetherell ntlworld.com> writes:
W這dzimierz Skiba wrote:
 Mike Wetherell <mike.wetherell ntlworld.com> wrote in
 news:cp5dlq$2p1m$1 digitaldaemon.com:
 ABX, I've prepared a minimal example, does this demonstrate
 the problem on your machine too

Yes, indeed, thanks!

Ok, thats good :-) Regards, Mike
Dec 09 2004
prev sibling parent reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
"W這dzimierz Skiba" <abx abx.art.pl> wrote in
news:cp7f9a$2pbt$1 digitaldaemon.com: 

 Mike Wetherell <mike.wetherell ntlworld.com> wrote in
 news:cp5dlq$2p1m$1 digitaldaemon.com: 
 ABX, I've prepared a minimal example, does this demonstrate
 the problem on your machine too

Yes, indeed, thanks! I pasted your minimal sample into our tests/streams/datastreamtest.cpp and run it through our building process. The error was: wxFileInputStream *p = new wxFileInputStream(_T("mytext.dat")); ^ streams\datastreamtest.cpp(27) : Error: reference must refer to same type

Since there was no sign that this topic was accepted as valid bug report, Walter, could you please comfirm that it was added to your bug list or that we need to do something more for you? Thanks in advance and Merry Christmas! ABX
Dec 24 2004
parent "Walter" <newshound digitalmars.com> writes:
"W這dzimierz Skiba" <abx abx.art.pl> wrote in message
news:cqgko8$29dg$1 digitaldaemon.com...
 Since there was no sign that this topic was accepted as valid bug report,
 Walter, could you please comfirm that it was added to your bug list or

 we need to do something more for you?

Yes, it's on the list. Thanks!
Dec 27 2004
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Mike Wetherell" <mike.wetherell ntlworld.com> wrote in message
news:cp5dlq$2p1m$1 digitaldaemon.com...
 ABX, I've prepared a minimal example, does this demonstrate
 the problem on your machine too, I think maybe you are
 using a newer version than me?

I've boiled that example down to this which generates the same error message: --------------------------------------- struct wxFile { wxFile(const char*); }; struct wxString { wxString(const char*); }; struct wxFileInputStream { wxFileInputStream(const wxString&); wxFileInputStream(wxFile&); }; void test() { new wxFileInputStream("mytext.dat"); } -------------------------------------------- It looks to me like the code is wrong, i.e. which wxFileInputStream should it pick?
Dec 27 2004
next sibling parent Michael Wetherell <mike.wetherell ntlworld.com> writes:
Walter wrote:
 It looks to me like the code is wrong, i.e. which wxFileInputStream
 should it pick?

I think it should choose the other one. I.e. not consider the illegal conversion path as one of the possibilities. I can't point to where in the standard it says DMC is wrong though. So if you tell me the standard is ambiguous then I'll believe you. OTOH it makes more sense the other way, and other compilers all do it that way. Regards, Mike
Dec 27 2004
prev sibling parent reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
"Walter" <newshound digitalmars.com> wrote in
news:cqokq7$u8i$1 digitaldaemon.com: 

 
 "Mike Wetherell" <mike.wetherell ntlworld.com> wrote in message
 news:cp5dlq$2p1m$1 digitaldaemon.com...
 ABX, I've prepared a minimal example, does this demonstrate
 the problem on your machine too, I think maybe you are
 using a newer version than me?

I've boiled that example down to this which generates the same error message: [cut] It looks to me like the code is wrong, i.e. which wxFileInputStream should it pick?

For interested, the answer was at the http://lists.wxwidgets.org/cgi-bin/ezmlm-cgi?5:mss:55898 ABX
Dec 28 2004
parent "Walter" <newshound digitalmars.com> writes:
"W這dzimierz Skiba" <abx abx.art.pl> wrote in message
news:cqrbjd$q4k$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in
 news:cqokq7$u8i$1 digitaldaemon.com:

 "Mike Wetherell" <mike.wetherell ntlworld.com> wrote in message
 news:cp5dlq$2p1m$1 digitaldaemon.com...
 ABX, I've prepared a minimal example, does this demonstrate
 the problem on your machine too, I think maybe you are
 using a newer version than me?

I've boiled that example down to this which generates the same error message: [cut] It looks to me like the code is wrong, i.e. which wxFileInputStream should it pick?

For interested, the answer was at the http://lists.wxwidgets.org/cgi-bin/ezmlm-cgi?5:mss:55898

Ok. In the meantime, just add another overload for (char*) and it should work fine. -Walter
Dec 29 2004