[Issue 14477] New: Nullable does not work with structs with default constructor disabled
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Apr 21 11:12:51 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14477
Issue ID: 14477
Summary: Nullable does not work with structs with default
constructor disabled
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: justin at economicmodeling.com
The following simple code does not compile:
--------------------------
import std.typecons;
struct Foo
{
int x;
@disable this();
this(int value) { x=value; }
}
void main()
{
Nullable!Foo foo;
}
--------------------------
test.d(14): Error: variable test.main.foo default construction is disabled for
type Nullable!(Foo)
Of course, one of the major use-cases for Nullable is to provide a way to
default-initialize such a struct to a "null" state.
--
More information about the Digitalmars-d-bugs
mailing list