[Issue 12918] Copying-constructing structs onto the heap

2016-07-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12918

Thayne  changed:

   What|Removed |Added

 CC||astrotha...@gmail.com

--- Comment #4 from Thayne  ---
A workaround for this is to allocate a Foo then assign it to the struct.

struct Foo
{
int i;
}

void main()
{
auto f = Foo(5);
auto g = new Foo;
*g = f;
}

However, if the Foo struct has the default constructor disabled (@disable
this();) then this doesn't work, even if postblit isn't disabled. The only way
I can think of to get this to work in general would be something like this:

auto f= Foo(5);
auto g = cast(Foo*) (new ubyte[Foo.sizeof]).ptr;
*g = f;

which is pretty awkward.

--


[Issue 16312] "Error: Overlapping fields" caused by use of deprecated features in referred to fields

2016-07-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16312

--- Comment #3 from Marco Leise  ---
I just got the overlapping fields error after a bunch of "undefined identifier"
errors. So it doesn't only happen after deprecated features are used. It
happens with both dmd 2.069 and 2.071.1 at least. Other compilers were not
tested.

--


[Issue 16312] "Error: Overlapping fields" caused by use of deprecated features in referred to fields

2016-07-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16312

Marco Leise  changed:

   What|Removed |Added

   Keywords|rejects-valid   |

--- Comment #2 from Marco Leise  ---
This report is about the first point, yes. Even if treated as an error,
"deprecated" means the compiler can still handle the situation. I suggest, not
to poison the AST for "deprecated as error" and "warning as error", but just
print the error and continue compilation as normal. (And return -1 from main.)
Does that seem feasible?

--


[Issue 16314] New: private copyBackwards is broken

2016-07-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16314

  Issue ID: 16314
   Summary: private copyBackwards is broken
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: ilyayaroshe...@gmail.com

Bug found by reviewing the source code. So, no user code example

--


[Issue 16313] New: Duplicate symbol generated

2016-07-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16313

  Issue ID: 16313
   Summary: Duplicate symbol generated
   Product: D
   Version: D2
  Hardware: x86_64
OS: Mac OS X
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: jmalim...@gmail.com

The compiler generates duplicated symbols for "my_array" in the following code
snippet and causes the linker to fail. 
The issue is triggered by the circular reference in line 18 (which is perfectly
legal btw). Commenting that line and the error goes away. This issue is present
in 2.071.1 on OSX and windows at least, but not present in version 2.067.1, at
least not in OSX or linux.   

01  struct Foo {
02  int a;
03  immutable(Foo[])* b;
04  this(int _a, immutable(Foo[])* _b)
05  {
06  a = _a;
07  b = _b;
08  }
09  this(int _a)
10  {
11  this(_a, null);
12  }
13  };
14
15  immutable Foo[] my_array = [
16  Foo(1),
17  Foo(2),
18  Foo(3, _array),
19  ];
20
21  void main()
22  {
23  int a = my_array[0].a;
24  }

--