c++.wxwindows - error in recent dmc
- chris elliott (31/31) Jun 01 2005 I got this with a recent (843.6n) dmc, but it was ok in about 834/835
- Walter (8/9) Jun 01 2005 This is the problem line, it tries to convert:
- chris elliott (3/17) Jun 02 2005 thank you for the clear explanation
- Walter (7/16) Jun 02 2005 I forgot to mention, the reason it "worked" before was the compiler rewr...
- chris elliott (4/27) Jun 03 2005 thanks, the code also "works" with VC, Borland, watcom compilers (and I
- chris elliott (3/10) Jun 03 2005 I forgot to say, how good it is to have dm spot such code bugs !Thanks
I got this with a recent (843.6n) dmc, but it was ok in about 834/835 Is this a bug, or something wrong in the wxWidgets code (code based on oleutils.h) chris C:\compiler>dmc -mn -c -g -o+none -Ar -Ae -H -HO- dmc_test.cpp dmc_test.cpp(9) : Error: reference must refer to same type or be const Had: int and: int & { ^ dmc_test.cpp(18) : Error: '=', ';' or ',' expected } ^ dmc_test.cpp(20) : Error: identifier or '( declarator )' expected --- errorlevel 1 dmc_test.cpp: #define ULONG int class wxAutoULong { public: wxAutoULong(ULONG value = 0) : m_Value(value) { } operator ULONG&() { return m_Value; } ULONG& operator=(ULONG value) { return m_Value = value; } private: ULONG m_Value; }; wxAutoULong A, B ; int main { A=B; }
Jun 01 2005
"chris elliott" <biol75 york.ac.uk> wrote in message news:d7kk7t$1uld$1 digitaldaemon.com...ULONG& operator=(ULONG value) { return m_Value = value; }This is the problem line, it tries to convert: return m_Value=value; into a reference. But it isn't a reference, it's an assignment expression. Rewrite as: m_Value = value; return m_Value;
Jun 01 2005
thank you for the clear explanation chris Walter wrote:"chris elliott" <biol75 york.ac.uk> wrote in message news:d7kk7t$1uld$1 digitaldaemon.com...ULONG& operator=(ULONG value) { return m_Value = value; }This is the problem line, it tries to convert: return m_Value=value; into a reference. But it isn't a reference, it's an assignment expression. Rewrite as: m_Value = value; return m_Value;
Jun 02 2005
"Walter" <newshound digitalmars.com> wrote in message news:d7lfbj$2nmg$1 digitaldaemon.com..."chris elliott" <biol75 york.ac.uk> wrote in message news:d7kk7t$1uld$1 digitaldaemon.com...I forgot to mention, the reason it "worked" before was the compiler rewrote the code as: tmp = (m_Value = value); return tmp; This is no longer in conformance with the C++ Standard, so was removed.ULONG& operator=(ULONG value) { return m_Value = value; }This is the problem line, it tries to convert: return m_Value=value; into a reference. But it isn't a reference, it's an assignment expression. Rewrite as: m_Value = value; return m_Value;
Jun 02 2005
Walter wrote:"Walter" <newshound digitalmars.com> wrote in message news:d7lfbj$2nmg$1 digitaldaemon.com...thanks, the code also "works" with VC, Borland, watcom compilers (and I guess gcc) chris"chris elliott" <biol75 york.ac.uk> wrote in message news:d7kk7t$1uld$1 digitaldaemon.com...I forgot to mention, the reason it "worked" before was the compiler rewrote the code as: tmp = (m_Value = value); return tmp; This is no longer in conformance with the C++ Standard, so was removed.ULONG& operator=(ULONG value) { return m_Value = value; }This is the problem line, it tries to convert: return m_Value=value; into a reference. But it isn't a reference, it's an assignment expression. Rewrite as: m_Value = value; return m_Value;
Jun 03 2005
chris elliott wrote:I forgot to say, how good it is to have dm spot such code bugs !Thanks again for all the rapid supportthanks, the code also "works" with VC, Borland, watcom compilers (and I guess gcc) chris
Jun 03 2005