digitalmars.D.learn - Problems with const/non-const overloads of member functions
- Richard Webb <richard.webb boldonjames.com> Jun 25 2010
- "Steven Schveighoffer" <schveiguy yahoo.com> Jun 25 2010
Using the latest DMD2, the code:
//
class c1
{
void foo() const
{
}
void foo()
{
}
void bar() const
{
foo();
}
}
//
fails to compile with the error:
constest.d(15): Error: function constest.c1.foo () is not callable using
argument types () const
However, if i either:
1) Change bar() to call this.foo() or
2) switch the 2 foo()s so that the const version is defined second.
The it compiles ok.
There are various const related issues in the bug tracker, but i don't
immediately see this one. Anyone know if it's a known thing?
Thanks,
Richard Webb
Jun 25 2010
On Fri, 25 Jun 2010 09:09:07 -0400, Richard Webb <richard.webb boldonjames.com> wrote:Using the latest DMD2, the code: // class c1 { void foo() const { } void foo() { } void bar() const { foo(); } } // fails to compile with the error: constest.d(15): Error: function constest.c1.foo () is not callable using argument types () const However, if i either: 1) Change bar() to call this.foo() or 2) switch the 2 foo()s so that the const version is defined second. The it compiles ok. There are various const related issues in the bug tracker, but i don't immediately see this one. Anyone know if it's a known thing?
File it anyways, if it's a repeat then it probably will just be closed as a duplicate. As long as you do a reasonable effort to search, nobody can fault you for adding a duplicate bug :) -steve
Jun 25 2010








"Steven Schveighoffer" <schveiguy yahoo.com>