| Thread overview | |||||
|---|---|---|---|---|---|
|
July 20, 2015 wrong code: code with undeclared variables compiles (cf b/14813) | ||||
|---|---|---|---|---|
| ||||
Attachments:
| reposting https://issues.dlang.org/show_bug.cgi?id=14813 here as it seems quite weird: /+ dmd -c -o- main.d how come this even compiles? +/ main.d: ----------- void fun() { alias A = void delegate(int); //WTF? A temp1 = (some_inexistant_field) { }; //WTF? A temp2 = delegate(some_inexistant_field) { }; alias A2 = void delegate(int,double); //WTF? A2 temp3 = (some_inexistant_field,sadfasfd) { }; } | |||
July 20, 2015 Re: wrong code: code with undeclared variables compiles (cf b/14813) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Timothee Cour | On Monday, 20 July 2015 at 07:01:34 UTC, Timothee Cour wrote: > reposting https://issues.dlang.org/show_bug.cgi?id=14813 here as it seems quite weird: Try this and think again: import std.stdio; void main() { alias A = void delegate(int); //WTF? A temp1 = (some_inexistant_field) { writeln(typeof(some_inexistant_field).stringof); }; temp1(42); //WTF? A temp2 = delegate(some_inexistant_field) { writeln(typeof (some_inexistant_field).stringof); }; temp2(1337); alias A2 = void delegate(int,double); //WTF? A2 temp3 = (some_inexistant_field,sadfasfd) { writeln(typeof(some_inexistant_field).stringof, " ", typeof(sadfasfd).stringof); }; temp3(42, 3.14); } | |||
July 20, 2015 Re: wrong code: code with undeclared variables compiles (cf b/14813) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Adrian Matoga Attachments:
| sorry, not sure what i was thinking... happens when you post late... thanks!
On Mon, Jul 20, 2015 at 12:09 AM, Adrian Matoga via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
> On Monday, 20 July 2015 at 07:01:34 UTC, Timothee Cour wrote:
>
>> reposting https://issues.dlang.org/show_bug.cgi?id=14813 here as it seems quite weird:
>>
>
> Try this and think again:
>
> import std.stdio;
>
> void main()
> {
> alias A = void delegate(int);
> //WTF?
> A temp1 = (some_inexistant_field) {
> writeln(typeof(some_inexistant_field).stringof); };
> temp1(42);
> //WTF?
> A temp2 = delegate(some_inexistant_field) { writeln(typeof
> (some_inexistant_field).stringof); };
> temp2(1337);
> alias A2 = void delegate(int,double);
> //WTF?
> A2 temp3 = (some_inexistant_field,sadfasfd) {
> writeln(typeof(some_inexistant_field).stringof, " ",
> typeof(sadfasfd).stringof); };
> temp3(42, 3.14);
> }
>
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply