c++.wxwindows - error in recent dmc
- chris elliott <biol75 york.ac.uk> Jun 01 2005
- "Walter" <newshound digitalmars.com> Jun 01 2005
- chris elliott <biol75 york.ac.uk> Jun 02 2005
- "Walter" <newshound digitalmars.com> Jun 02 2005
- chris elliott <biol75 york.ac.uk> Jun 03 2005
- chris elliott <biol75 york.ac.uk> Jun 03 2005
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...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;
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.
Jun 02 2005
Walter wrote:"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...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;
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.
guess gcc) chris
Jun 03 2005
chris elliott wrote:
again for all the rapid support
guess gcc) chris
Jun 03 2005









chris elliott <biol75 york.ac.uk> 