On Friday, 4 October 2013 at 06:22:57 UTC, Ali Çehreli wrote:
On 10/03/2013 11:10 PM, deadalnix wrote:
> On Friday, 4 October 2013 at 05:07:53 UTC, Zhouxuan wrote:
>> ////////////////////////////////////////////////////////////
>> //case 1
>>
>> class A
>> {
>> abstract void foo();
>> }
>>
>> class B : A
>> {
>> static if( __traits(isAbstractClass, typeof(this) ))
>
> this is invalid here. Not sure what you try to achieve via
this static if.
Well, obviously that is the reason for the bug. :) I think
Zhouxuan thinks that it is an 'abstract' bug but actually it is
some sort of __traits caching issue.
It would indeed be weird for isAbstractClass to delay its value
until the whole class definition is seen.
Instead, what seems to happen is that isAbstractClass caches
the first value that it determines and perhaps at least for
consistency uses that value. Moving isAbstractClass after the
definition of B.foo removes the issue in this case:
Indeed I found the issue from use of isAbstractClass, but after
some
tests I'm confused by these abstract use cases.