June 25, 2010 Problems with const/non-const overloads of member functions | ||||
---|---|---|---|---|
| ||||
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 |
June 25, 2010 Re: Problems with const/non-const overloads of member functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Richard Webb | 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
|
Copyright © 1999-2021 by the D Language Foundation