[Issue 23142] New: Scope should not apply to unittests
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri May 27 05:23:38 UTC 2022
    
    
  
https://issues.dlang.org/show_bug.cgi?id=23142
          Issue ID: 23142
           Summary: Scope should not apply to unittests
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: alphaglosined at gmail.com
When declaring in a class or struct a unittest block should ignore any scope
attributes set due to not having a context pointer.
```d
void main()
{
}
struct Foo
{
    int x;
scope:
    void func()
    {
    }
    unittest
    {
    }
}
```
onlineapp.d(9): Error: function `onlineapp.Foo.__unittest_L9_C4` functions
cannot be `scope`
This error is not at all helpful and prevents a common use case for unittests
as documentation without writing scope on every method which is very
error-prone.
--
    
    
More information about the Digitalmars-d-bugs
mailing list