[Issue 8118] Impossible to initialize a member struct without default constructor or assigment

2013-11-28 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=8118


Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #7 from Kenji Hara  2013-11-28 20:39:33 PST ---
(In reply to comment #6)
> This seems to be fixed now (code compiles and runs on 2.064).

The OP case is fixed in 2.064, by fixing issue 9665.

(In reply to comment #5)
> I haven't checked, but it could allow code like this if not currently 
> possible:
> 
> S s = void;
> if (xyz) {
>   s = S(3);
> } else {
>   s = S(7);
> }

This is completely different case. It would need to use std.conv.emplace.

*** This issue has been marked as a duplicate of issue 9665 ***

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8118] Impossible to initialize a member struct without default constructor or assigment

2013-11-28 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=8118


Simen Kjaeraas  changed:

   What|Removed |Added

 CC||simen.kja...@gmail.com


--- Comment #6 from Simen Kjaeraas  2013-11-28 12:13:34 
PST ---
This seems to be fixed now (code compiles and runs on 2.064).

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8118] Impossible to initialize a member struct without default constructor or assigment

2013-02-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8118


Marco Leise  changed:

   What|Removed |Added

 CC||marco.le...@gmx.de


--- Comment #5 from Marco Leise  2013-02-15 06:17:42 PST ---
(In reply to comment #4)
> The fact that it's **impossible** to call the constructor directly without an
> assignment getting in the way (as far as I see) is a bug.

I agree with you. I have a struct that is not supposed to be copied. Now I
cannot use it as a field in any other struct/class.

In some cases a work-around may be to allow assignments, but check that the
receiver is S.init.

Also I tried "= void" first. So it may be the most intuitive to use for the bug
fix.

I haven't checked, but it could allow code like this if not currently possible:

S s = void;
if (xyz) {
  s = S(3);
} else {
  s = S(7);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8118] Impossible to initialize a member struct without default constructor or assigment

2012-05-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8118



--- Comment #4 from wfunct...@hotmail.com 2012-05-19 12:17:48 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > No bug here you just diabled too much. Undisable opAssign.
> > 
> > It's opAssign that gets called whne a = ... is seen:
> > this() { s = S(to!int("1")); }
> > If opAssign is trivial it replaced with bitblit. (that is disable comes 
> > first!)
> 
> Uh, no, it's a bug IMO.
> 
> 
> I never asked for an assignment. I want to CONSTRUCT the object manually.

For example, pretend this is the Scoped struct. I *obviously* wouldn't want to
assign anything, but I'd want to construct the object.

The fact that it's **impossible** to call the constructor directly without an
assignment getting in the way (as far as I see) is a bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8118] Impossible to initialize a member struct without default constructor or assigment

2012-05-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8118



--- Comment #3 from wfunct...@hotmail.com 2012-05-19 12:15:42 PDT ---
(In reply to comment #2)
> No bug here you just diabled too much. Undisable opAssign.
> 
> It's opAssign that gets called whne a = ... is seen:
> this() { s = S(to!int("1")); }
> If opAssign is trivial it replaced with bitblit. (that is disable comes 
> first!)

Uh, no, it's a bug IMO.


I never asked for an assignment. I want to CONSTRUCT the object manually.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8118] Impossible to initialize a member struct without default constructor or assigment

2012-05-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8118


Dmitry Olshansky  changed:

   What|Removed |Added

 CC||dmitry.o...@gmail.com


--- Comment #2 from Dmitry Olshansky  2012-05-19 
03:44:28 PDT ---
(In reply to comment #0)
> struct S
> {
> @disable this();
> this(int) { }
> @disable void opAssign(typeof(this));
> }
> 
> class Test
> {
> S s = void;  // I *EXPLICITLY* told it not to be initialized, but...
> this() { s = S(to!int("1")); }
> }
> 
> void main() { new Test(); }
> 
> 
> Error: function S.opAssign is not callable because it is annotated with
> @disable
> Error: default construction is disabled for type Test
> 
> 
> 
> Structs without default constructors are pretty much impossible to use.
No bug here you just diabled too much. Undisable opAssign.

It's opAssign that gets called whne a = ... is seen:
this() { s = S(to!int("1")); }
If opAssign is trivial it replaced with bitblit. (that is disable comes first!)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8118] Impossible to initialize a member struct without default constructor or assigment

2012-05-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8118



--- Comment #1 from wfunct...@hotmail.com 2012-05-18 17:05:45 PDT ---
Possibly related:
http://d.puremagic.com/issues/show_bug.cgi?id=8117

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---