Thread overview | |||||
---|---|---|---|---|---|
|
January 29, 2010 [dmd-beta] dmd1beta test | ||||
---|---|---|---|---|
| ||||
I've successfully compiled Tango with dmd1beta.
But one of my apps don't compile anymore.
Is it a bug?:
uint* getInstance() {
return new uint;
}
struct Foo {
uint* x;
}
void main(char[][] args){
Foo o = {getInstance()};
}
/*
main.d(226): Error: Cannot interpret new uint at compile time
main.d(236): Error: cannot evaluate getInstance() at compile time
*/
--
Moritz Warning <moritz.warning at uni-bielefeld.de>
|
January 29, 2010 [dmd-beta] dmd1beta test | ||||
---|---|---|---|---|
| ||||
Posted in reply to Moritz Warning | That looks like a bug in your code. If it was allowed before, I wonder what was put into the o instance.
anything between {} has to be evaluated at compile time, I think that rule has been in force for a long time.
The code should be:
Foo o = Foo(getInstance());
-Steve
----- Original Message ----
> From: Moritz Warning <moritz.warning at uni-bielefeld.de>
> To: dmd-beta at puremagic.com
> Sent: Fri, January 29, 2010 7:41:11 AM
> Subject: [dmd-beta] dmd1beta test
>
> I've successfully compiled Tango with dmd1beta.
>
> But one of my apps don't compile anymore.
> Is it a bug?:
>
> uint* getInstance() {
> return new uint;
> }
>
> struct Foo {
> uint* x;
> }
>
> void main(char[][] args){
> Foo o = {getInstance()};
> }
> /*
> main.d(226): Error: Cannot interpret new uint at compile time
> main.d(236): Error: cannot evaluate getInstance() at compile time
> */
>
> --
> Moritz Warning
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
|
January 30, 2010 [dmd-beta] dmd1beta test | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steve Schveighoffer | On Friday 29 January 2010 22:43 Steve Schveighoffer wrote: > That looks like a bug in your code. If it was allowed before, I wonder > what was put into the o instance. > > anything between {} has to be evaluated at compile time, I think that rule > has been in force for a long time. No it didn't have to be evaluatable at compile time. In response to http://d.puremagic.com/issues/show_bug.cgi?id=2380 Walter added this to the spec: - The static initializer syntax can also be used to initialize non-static variables, provided that the member names are not given. The initializer need not be evaluatable at compile time. - So this sounds like a regression. Christian -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20100130/0c2a72c1/attachment.pgp> |
Copyright © 1999-2021 by the D Language Foundation