|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Conversion member template bug
Not sure if this is covered by Christof's comprehensive coverage, but here
is just in case
struct S
{
// Construction
public:
S(int i)
: m_i(i)
{}
// Conversion
public:
template <class T>
operator T () const
{
return (T)m_i;
}
// Members
protected:
int m_i;
};
void fn(int )
{}
int main(int, char**)
{
S s(100);
fn(s);
return 0;
}
The 8.32.12b gives
H:\Dev\Test\compiler\dm\null_v_bug>dmc optbug.cpp
optbug.cpp(15) : Error: 'S::operator int' is already defined
fn(s);
^
optbug.cpp(41) : Error: need explicit cast for function parameter 1 to get
from: S
to : int
--- errorlevel 1
If I changes the fn call to
fn((int)s);
then it works, but that kind-of defeats the purpose. ;)
Matthew
Dec 16 2002
Walter Any ETA with this one ... :) Matthew "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atlkke$2d99$1 digitaldaemon.com... Dec 17 2002
Orsen Welles comes to mind <g>. "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atoi7h$1hmn$1 digitaldaemon.com...Walter Any ETA with this one ... :) Matthew "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atlkke$2d99$1 digitaldaemon.com...Not sure if this is covered by Christof's comprehensive coverage, but Dec 17 2002
You've completely lost me, Walter. Either you're more inscrutable than I can handle, or I've been so much documentation that my brain has turned to sandstone. "Walter" <walter digitalmars.com> wrote in message news:atoj5d$1i8t$1 digitaldaemon.com...Orsen Welles comes to mind <g>. "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atoi7h$1hmn$1 digitaldaemon.com...Walter Any ETA with this one ... :) Matthew "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atlkke$2d99$1 digitaldaemon.com...Not sure if this is covered by Christof's comprehensive coverage, but Dec 17 2002
Orsen Welles selling Gallo wine: "We will sell no wine before its time." Often parodied at the time, but I suppose it's been too many years <g>. "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atone6$1l4v$1 digitaldaemon.com...You've completely lost me, Walter. Either you're more inscrutable than I Dec 17 2002
No worries. I have a little patience on this matter ... :) "Walter" <walter digitalmars.com> wrote in message news:atp3so$1tlk$1 digitaldaemon.com...Orsen Welles selling Gallo wine: "We will sell no wine before its time." Often parodied at the time, but I suppose it's been too many years <g>. "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atone6$1l4v$1 digitaldaemon.com...You've completely lost me, Walter. Either you're more inscrutable than I Dec 18 2002
In any case, I fixed it and it'll go out in the next update. -Walter "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atpcqb$2513$1 digitaldaemon.com...No worries. I have a little patience on this matter ... :) Dec 18 2002
Excellent stuff! (As usual) We again doff our collective cap to the esteemed compiler walter. :) "Walter" <walter digitalmars.com> wrote in message news:atpj7q$29rm$1 digitaldaemon.com...In any case, I fixed it and it'll go out in the next update. -Walter "Matthew Wilson" <dmd synesis.com.au> wrote in message news:atpcqb$2513$1 digitaldaemon.com...No worries. I have a little patience on this matter ... :) Dec 18 2002
|