c++ - Conversion member template bug
- Matthew Wilson (41/41) Dec 16 2002 Not sure if this is covered by Christof's comprehensive coverage, but he...
- Matthew Wilson (5/46) Dec 17 2002 Walter
-
Walter
(5/67)
Dec 17 2002
Orsen Welles comes to mind
. - Matthew Wilson (5/77) Dec 17 2002 You've completely lost me, Walter. Either you're more inscrutable than I...
- Walter (7/87) Dec 17 2002 Orsen Welles selling Gallo wine: "We will sell no wine before its time."
- Matthew Wilson (4/94) Dec 18 2002 No worries. I have a little patience on this matter ... :)
- Walter (3/4) Dec 18 2002 In any case, I fixed it and it'll go out in the next update. -Walter
- Matthew Wilson (4/8) Dec 18 2002 Excellent stuff! (As usual)
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...
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 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...hereNot sure if this is covered by Christof's comprehensive coverage, butgetis 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 tofrom: 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 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...hereNot sure if this is covered by Christof's comprehensive coverage, butgetis 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 tofrom: 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 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 Icanhandle, 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...butOrsen 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,tohereis 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 1getfrom: 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 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...1You've completely lost me, Walter. Either you're more inscrutable than Icanhandle, 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...butOrsen 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,hereis 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 parametertogetfrom: 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 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








"Matthew Wilson" <dmd synesis.com.au>