April 09, 2012
I'm getting an ICE as a regression:

mtype.c:4472: StructDeclaration* TypeAArray::getImpl(): Assertion `impl' failed.

DustMite-int it now...

_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 09, 2012
On 9 Apr 2012, at 21:18, Nick Sabalausky wrote:
> I'm getting an ICE as a regression:
>
> mtype.c:4472: StructDeclaration* TypeAArray::getImpl(): Assertion `impl' failed.
>
> DustMite-int it now...

Try directly instantiating the AssociativeArray template – this way you should be able to see the underlying error message.

David
_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta
April 09, 2012
From: "Nick Sabalausky" <bus_dmdbeta@semitwist.com>
> I'm getting an ICE as a regression:
>
> mtype.c:4472: StructDeclaration* TypeAArray::getImpl(): Assertion `impl' failed.
>
> DustMite-int it now...
>

Turned out to be this problem:

http://d.puremagic.com/issues/show_bug.cgi?id=7695

Which is a regression that was introduced in 2.058. Not sure why my original code didn't trigger it on 2.058 though.

_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 09, 2012
I suppose this could be classified as a regression?

Can't specify static field with 'this.'

void main() {
}

class A {
    static int a;

    static void foo(int a) {
        this.a = a;
    }
}

test.d(8): Error: 'this' is only defined in non-static member functions, not foo

On Mon, Apr 9, 2012 at 12:01 AM, Walter Bright <walter@digitalmars.com> wrote:
>
> http://ftp.digitalmars.com/dmd2beta.zip
_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 09, 2012
I believe the error message is correct.

On 4/9/2012 1:53 PM, Jesse Phillips wrote:
> I suppose this could be classified as a regression?
>
> Can't specify static field with 'this.'
>
> void main() {
> }
>
> class A {
>      static int a;
>
>      static void foo(int a) {
>          this.a = a;
>      }
> }
>
> test.d(8): Error: 'this' is only defined in non-static member functions, not foo
>
>
_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 09, 2012
On 4/9/12, Walter Bright <walter@digitalmars.com> wrote:
> I believe the error message is correct.

I don't know about that. in TDPL p197 it says:
"If you use an object instead of the class name when accessing a
static member, that's fine, too.:
auto c = (new Widget).someStaticMember"

It would naturally follow that using 'this' for static members would
be ok as well. Why break code now?
_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 09, 2012

On 4/9/2012 2:24 PM, Andrej Mitrovic wrote:
> On 4/9/12, Walter Bright<walter@digitalmars.com>  wrote:
>> I believe the error message is correct.
> I don't know about that. in TDPL p197 it says:
> "If you use an object instead of the class name when accessing a
> static member, that's fine, too.:
> auto c = (new Widget).someStaticMember"

(new Widget) exists. The 'this' doesn't exist in a static function.

>
> It would naturally follow that using 'this' for static members would
> be ok as well. Why break code now?


The code is already incorrect. It makes no sense to allow a 'this' which does not exist.
_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 09, 2012
Yeah, but 'this' isn't defined inside static member functions.  The error message is most certainly correct.

I'll also point out that if you really want to clarify what 'a' you are talking about, you can do:

typeof(this).a = a;


typeof(this) is special cased so it always works, even in static member functions that do not have a 'this' parameter.

-Steve




>________________________________
> From: Andrej Mitrovic <andrej.mitrovich@gmail.com>
>To: Discuss the dmd beta releases for D <dmd-beta@puremagic.com>
>Sent: Monday, April 9, 2012 5:24 PM
>Subject: Re: [dmd-beta] D 2.059 beta 4
> 
>On 4/9/12, Walter Bright <walter@digitalmars.com> wrote:
>> I believe the error message is correct.
>
>I don't know about that. in TDPL p197 it says:
>"If you use an object instead of the class name when accessing a
>static member, that's fine, too.:
>auto c = (new Widget).someStaticMember"
>
>It would naturally follow that using 'this' for static members would
>be ok as well. Why break code now?
>_______________________________________________
>dmd-beta mailing list
>dmd-beta@puremagic.com
>http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
>
>

April 09, 2012
From: "David Nadlinger" <code@klickverbot.at>
> On 9 Apr 2012, at 21:18, Nick Sabalausky wrote:
>> I'm getting an ICE as a regression:
>>
>> mtype.c:4472: StructDeclaration* TypeAArray::getImpl(): Assertion `impl' failed.
>>
>> DustMite-int it now...
>
> Try directly instantiating the AssociativeArray template – this way you should be able to see the underlying error message.
>

Thanks. At one point, it's trying to pass a const(MyStruct) to MyStruct.opEquals, and I forgot to keep the const overload when 2.059 is detected (ATM I only have the the new non-const non-ref opEquals when 2.059 is detected). So that's why I'm not getting that ICE in 2.058.

I'm not going to end up *also* needing "const non-ref" and/or "non-const ref" versions too, am I? I think my brain's turning to mud now...

_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta
April 10, 2012
On 4/9/12, Steve Schveighoffer <schveiguy@yahoo.com> wrote:
> I'll also point out that if you really want to clarify what 'a' you are talking about, you can do:
>
> typeof(this).a = a;

Yeah, I was mainly concerned with convenience and not semantics. 'this.a = a' is a simple way to disambiguate between parameters and fields.

Side-note: I frequently use an "alias typeof(this) This;" in my
classes so I don't have to hard-code the name of the class/struct. I
sort of wish 'This' was implicitly given to us for every struct/class
type. :)
_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta