is(T == const) for function types

Ali Çehreli acehreli at yahoo.com
Tue Dec 25 14:45:51 PST 2012


On 12/25/2012 12:59 PM, mist wrote:
> http://dpaste.dzfl.pl/0cda8d0f
>
> bug or feature?

For convenience to others, here is your code:

struct Test
{
     void delegate() const deleg;
}

void main()
{
     static assert( is(typeof(Test.deleg) == const) );
}

I don't know the answer but this works:

struct Test
{
     alias void delegate() Deleg;
     const Deleg deleg;
}

void main()
{
     static assert( is(typeof(Test.deleg) == const) );
}

Ali


More information about the Digitalmars-d-learn mailing list