www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12760] New: Initializing std.typecons.Nullable causes false

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 puremagic.com
          Reporter: sinkuu 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
}

```

--
May 17 2014