[Issue 12760] New: Initializing std.typecons.Nullable causes false warning "discards return value"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 17 19:12:49 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12760

          Issue ID: 12760
           Summary: Initializing std.typecons.Nullable causes false
                    warning "discards return value"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: sinkuu at aol.jp

```
import std.typecons : Nullable;

class C
{
    Nullable!int nullable;

    this()
    {
        nullable = 0; // Warning: calling
std.typecons.Nullable!int.Nullable.this without side effects discards return
value of type Nullable!int, prepend a cast(void) if intentional
    }
}

void main()
{
    Nullable!int n;
    n = 0; // ok
}

```

--


More information about the Digitalmars-d-bugs mailing list