[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

Richard Cattermole  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||alphaglosi...@gmail.com
 Resolution|--- |INVALID

--- Comment #4 from Richard Cattermole  ---
The inference can be seen when you use auto instead of scope inside of
safeUsage when you output the AST.

```d
struct Struct
{
int* p;
@safe void hmm(int i)
{
}
}
```

vs with scope & auto:

```d
struct Struct
{
int* p;
auto pure nothrow @nogc @safe void hmm(int i)
{
}
}
```

I don't see a bug here. This looks to be working correctly. A method that was
not annotated with scope, used with scope, works when inference is turned on.
So I'm closing.

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

--- Comment #3 from RazvanN  ---
So, if we enable attribute inference for all functions that have a body, this
will be fixed as a consequence. Or, the workaround would be to manually
annotate `hmm` as scope.

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

--- Comment #2 from RazvanN  ---
[...] for auto functions because a function body needs to be present*

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
Under the current specification this is not a bug, even though the behavior is
surprising. Attributes are inferred for auto functions because you a function
body needs to be present. Attributes are not inferred for non-auto functions,
even if the body is present.

--


[Issue 23933] auto return type disables DIP1000 scope check

2023-05-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23933

Atila Neves  changed:

   What|Removed |Added

   Keywords||accepts-invalid, safe

--