On Thursday, 7 July 2016 at 15:02:29 UTC, Jonathan M Davis wrote:
On Thursday, July 07, 2016 10:33:39 Basile B. via Digitalmars-d-learn wrote:
this compiles without error:


struct Foo
{
     int i;
     void bar()
     {
         void foo() const
         {
             i = 1;
         }
         foo;
     }
}

In this case "const" seems to be a noop. Do you think it's a bug ? Shouldn't "const" be applied, despite of foo() inaccessibility ?

It makes no sense for const to be used on foo. foo is not a member function, so there's nothing for the const to apply to.

`foo()` is effectively a delegate, therefore `const` applies to the context.

Reply via email to