[Issue 8973] core.cpuid.coresPerCPU returning incorrect value.

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8973

rsw0x  changed:

   What|Removed |Added

 CC||rs...@rsw0x.me
 OS|Windows |All
   Severity|trivial |normal

--- Comment #3 from rsw0x  ---
Returns 16 for me with FX-8350 on Linux 4.0 x86-64

Appears to be an AMD issue.

--


[Issue 14756] cannot deduce function with template constraint

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14756

Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Kenji Hara  ---
(In reply to Tim from comment #0)

This behavior change is an intentional bug fix. See issue 14290.

> enum bool isInstanceOf(alias S, T) = is(T == S!Args, Args...);
> 
> struct Test(size_t id)
> {
> static void from(Other)(Other other)
> if (isInstanceOf!(Test, Other))

In here, 'Test' represents an instantiated struct, not a template. By fixing
issue 14290, is-expression won't match to the instantiation form S!Args when S
is a struct.

> If the template constraint uses the is-expression directly, the error goes
> away.

When you rewrite the condition as follows:

static void from(Other)(Other other)
if (is(Other == Test!Args, Args...))

'Test' is still a struct, but in here, the is-expression can recognize it may
also represent the outer template Test(size_t id) because it's accessible
through the lexical scope.

To fix the issue, you need to pass explicitly the template 'Test' to the
isInstanceOf.

struct Test(size_t id)
{
static void from(Other)(Other other)
if (isInstanceOf!(.Test, Other))
// <-- Use Module Scope Operator (http://dlang.org/module)
{}
}

--


[Issue 14758] TypeInfo causes excessive binary bloat

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14758

Mike  changed:

   What|Removed |Added

   Keywords||bare-metal

--


[Issue 13678] TypeInfo.init is inconsistent

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13678

Mike  changed:

   What|Removed |Added

 CC||slavo5...@yahoo.com

--- Comment #1 from Mike  ---
https://github.com/D-Programming-Language/druntime/pull/1307 may provide a
solution to this.

--


[Issue 14758] New: TypeInfo causes excessive binary bloat

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14758

  Issue ID: 14758
   Summary: TypeInfo causes excessive binary bloat
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: slavo5...@yahoo.com

The way DMD generates TypeInfo causes excessive binary bloat so badly that D
absolutely cannot be used for resource constrained systems until this problem
is solved.

=Evidence=
Create two source files object.d and test.d in the same directory as show
below.

// object.d
module object;

alias immutable(char)[] string;

class Object
{ }

class TypeInfo
{ }

class TypeInfo_Class : TypeInfo
{
ubyte[136] ignore;
}

extern(C) void _d_dso_registry(void* data)
{ }

// test.d
module test;

long sys_write(long arg1, in void* arg2, long arg3)
{
long result;

asm
{
mov RAX, 1;
mov RDI, arg1;
mov RSI, arg2;
mov RDX, arg3;
syscall;
}

return result;
}

void write(in string text)
{
sys_write(2, text.ptr, text.length);
}

void write(A...)(in A a)
{
foreach(t; a)
{
write(t);
}
}

final abstract class TestClass1 { }
final abstract class TestClass2 { }
final abstract class TestClass3 { }
final abstract class TestClass4 { }
final abstract class TestClass5 { }
final abstract class TestClass6 { }
final abstract class TestClass7 { }
final abstract class TestClass8 { }
final abstract class TestClass9 { }

extern(C) void main()
{
write("Hello\n");
}

Compile on 64-bit Linux with ( This method compiles without phobos or druntime
to obtain the smallest possible binary):
dmd -m64 -defaultlib= -debuglib= -conf= -betterC -release object.d test.d
-oftest

Analyze with
objdump -s -j .rodata test

Contents of section .rodata:
 4006c0 01000200     
 4006d0 f0064000     ..@.
 4006e0 6f626a65 63742e4f 626a6563 7400  object.Object...
 4006f0 68126000     h.`.
 400700 20074000      .@.
 400710 6f626a65 63742e54 79706549 6e666f00  object.TypeInfo.
 400720 08136000     ..`.
 400730 d8074000     ..@.
 400740      
 400750      
 400760      
 400770      
 400780      
 400790      
 4007a0      
 4007b0      
 4007c0   54797065 496e666f  TypeInfo
 4007d0 5f436c61 7373 a8136000   _Class`.
 4007e0 00084000     ..@.
 4007f0 74657374 2e546573 74436c61 73733100  test.TestClass1.
 400800 48146000     H.`.
 400810 30084000     0.@.
 400820 74657374 2e546573 74436c61 73733200  test.TestClass2.
 400830 e8146000     ..`.
 400840 60084000     `.@.
 400850 74657374 2e546573 74436c61 73733300  test.TestClass3.
 400860 88156000     ..`.
 400870 90084000     ..@.
 400880 74657374 2e546573 74436c61 73733400  test.TestClass4.
 400890 28166000     (.`.
 4008a0 c0084000     ..@.
 4008b0 74657374 2e546573 74436c61 73733500  test.TestClass5.
 4008c0 c8166000     ..`.
 4008d0 f0084000     ..@.
 4008e0 74657374 2e546573 74436c61 73733600  test.TestClass6.
 4008f0 68176000     h.`.
 400900 20094000      .@.
 400910 74657374 2e546573 74436c61 73733700  test.TestClass7.
 400920 08186000     ..`.
 400930 50094000     P.@.
 400940 74657374 2e546573 74436c61 73733800  test.TestClass8.
 400950 a8186000     ..`.
 400960 80094000     ..@.
 400970 74657374 2e546573 74436c61 73733900  test.TestClass9.
 400980 48196000  48656c6c 6f0a  H.`.Hello...
 400990 0600  88094000   ..@.

One can see that although TypeInfo is used nowhere in the code, implicitly or
explicitly, it is still included in the binary; the TypeInfo.name field being
the greatest contributor to the problem.

I have an embedded system with a 

[Issue 14757] Wrong error message: Error: multi-dimensional slicing requires template opSlice

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14757

Timothee Cour  changed:

   What|Removed |Added

 CC||timothee.co...@gmail.com

--- Comment #1 from Timothee Cour  ---
forgot to add:
of course the error is that 'foobar()' doesn't compile, but the error message
provided completely hides that, and is confusing, since user did define
opSlice.
I'm guessing implementation uses something such as __traits(compiles, expr) to
check whether user defined the template and error gagging prevents showing it.

Either way, as it is, in larger programs, it can be very hard to figure out the
reason of the bug given poor compiler msg

--


[Issue 14757] New: Wrong error message: Error: multi-dimensional slicing requires template opSlice

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14757

  Issue ID: 14757
   Summary: Wrong error message: Error: multi-dimensional slicing
requires template opSlice
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: timothee.co...@gmail.com


struct A{
  auto opSlice(uint dim)(int a, int b){
foobar();
return 0;
  }

  auto opIndex(T...)(T args){
return 2;
  }
}

void main(){
  A a;
  a[0..1, 0];//Error: multi-dimensional slicing requires template opSlice
  //a[0..1];//slightly less cryptic error message for this
}


--


[Issue 14756] New: cannot deduce function with template constraint

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14756

  Issue ID: 14756
   Summary: cannot deduce function with template constraint
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: tim.dl...@t-online.de

The following code compiled with dmd v2.067, but results in an error for dmd
v2.068.0-b1:

// copied from std.traits
enum bool isInstanceOf(alias S, T) = is(T == S!Args, Args...);

struct Test(size_t id)
{
static void from(Other)(Other other) if(isInstanceOf!(Test, Other))
{
}
}

void main()
{
Test!(1) test;
Test!(2).from(test);
}

Here is the error message:
test.d(14): Error: template test.Test!2u.Test.from cannot deduce function from
argument types !()(Test!1u), candidates are:
test.d(6):test.Test!2u.Test.from(Other)(Other other) if
(isInstanceOf!(Test, Other))

If the template constraint uses the is-expression directly, the error goes
away.

--


[Issue 14754] [REG2.068b1] 64bit wrong code with -inline

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14754

Kenji Hara  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #3 from Kenji Hara  ---
https://github.com/D-Programming-Language/dmd/pull/4795

--


[Issue 14754] [REG2.068b1] 64bit wrong code with -inline

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14754

--- Comment #2 from Kenji Hara  ---
Reduced test case:

auto aafunc(string k)
{
enum aa = [ "K": "V" ];
auto p = k in aa;
return null;
}

struct MapResult(alias fun, R)
{
R _input;

@property auto ref front()
{
return fun(_input[0]);
}
}

auto array(R)(R r)
{
alias E = typeof(r.front);
E[] result;
result ~= r.front;
return result;
}

auto mapfun(R)(R words, string k)
{
return array(MapResult!(s => aafunc(k), R)(words));
}

void main()
{
auto r = mapfun([""], "");
}

--


[Issue 13566] std.algorithm.cmp treats string length as element

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13566

--- Comment #3 from monarchdo...@gmail.com ---
(In reply to monarchdodra from comment #2)
> "static if (size_t.sizeof == int.sizeof"
> 
> wut?

Nevermind, I've been out of it recently :(

--


[Issue 14754] [REG2.068b1] 64bit wrong code with -inline

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14754

--- Comment #1 from Kenji Hara  ---
Introduced in: https://github.com/D-Programming-Language/dmd/pull/4505

--


[Issue 13566] std.algorithm.cmp treats string length as element

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13566

--- Comment #2 from monarchdo...@gmail.com ---
"static if (size_t.sizeof == int.sizeof"

wut?

--


[Issue 14748] Removing std.stdio import causes 2x increase in "Hello, world" program binary filesize

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14748

Kenji Hara  changed:

   What|Removed |Added

 OS|All |Linux

--- Comment #8 from Kenji Hara  ---
(In reply to Vladimir Panteleev from comment #6)
> The test machine that detected this is running Ubuntu Server 14.04 x64.

Looks like it's a platform-dependent issue.

--


[Issue 14748] Removing std.stdio import causes 2x increase in "Hello, world" program binary filesize

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14748

--- Comment #7 from Kenji Hara  ---
(In reply to Walter Bright from comment #2)
> (In reply to Walter Bright from comment #1)
> > On Win32, I get the same exe file size, and 'stream' symbols do not appear
> > in the executable.
> 
> The file size is 200Kb.

Also in Win64, PR 3443 does not introduce the binary size difference. The file
size is around 350Kb.

--


[Issue 14755] New: Could -profile=gc also give the number of allocations that led to X bytes being allocated?

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14755

  Issue ID: 14755
   Summary: Could -profile=gc also give the number of allocations
that led to X bytes being allocated?
   Product: D
   Version: D2
  Hardware: All
OS: Windows
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: alil...@gmail.com

Currently -profile=gc gives a list of top GC spots sorted by bytes (and that is
already useful). Could we also get the corresponding count of GC allocations
along with that number?

Rationale: not all memory is scanned and a frequent allocation of objects with
references worries me more than a big uint[] that happen only once.

--


[Issue 7517] Interface contracts broken

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7517

Kenji Hara  changed:

   What|Removed |Added

   Keywords||pull, wrong-code
   Hardware|x86 |All
 OS|Windows |All

--- Comment #2 from Kenji Hara  ---
(In reply to Rene Zwanenburg from comment #0)
> enable's in contract is not being called.

Today this is intended behavior. See the discussion in issue 6856.

> After setting _enabled to true an
> exception is thrown saying C does not implement opCmp(). 

This is definitely wrong-code bug.

https://github.com/D-Programming-Language/dmd/pull/4794

--


[Issue 14753] pragma(inline) hides the alias "string"

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14753

Kenji Hara  changed:

   What|Removed |Added

   Keywords||pull
   Severity|major   |blocker

--- Comment #1 from Kenji Hara  ---
https://github.com/D-Programming-Language/dmd/pull/4793

--


[Issue 14743] ICE in TemplateInstance::needsTypeInference() with template forward reference

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14743

Kenji Hara  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Kenji Hara  ---
https://github.com/D-Programming-Language/dmd/pull/4792

--


[Issue 14746] [REG2.068a] Behavior change with struct destructor and alias this

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14746

--- Comment #5 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/c8518f5b62ae501ea740bc1b1996230c9927c70f
fix Issue 14746 for postblitRecurse as well

https://github.com/D-Programming-Language/druntime/commit/e0f2ca65b719fcc94dbd484bb9a8a0fe219ef806
Merge pull request #1313 from MartinNowak/fix14746

fixup Issue 14746

--


[Issue 14746] [REG2.068a] Behavior change with struct destructor and alias this

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14746

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--


[Issue 14626] [REG2.066] byValue doesn't work with inout AA

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14626

--- Comment #3 from Martin Nowak  ---
Looks like the classical, mutable iterator over const/immutable container issue
complicated by inout.
Not sure if we can solve it with the current language features.

--


[Issue 14626] [REG2.066] byValue doesn't work with inout AA

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14626

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu

--- Comment #2 from Martin Nowak  ---
But byValue should work with const AAs and inout is convertible to const, so it
seems the template signature of byValue is incorrect.

--


[Issue 14750] druntime/test/coverage was added to druntime, but not to the MANIFEST - zip file broken again

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14750

--- Comment #4 from Martin Nowak  ---
(In reply to Walter Bright from comment #3)
> I'm fine if someone posts a method of doing this automatically. In the
> absence of such, it needs to be done manually. Otherwise, things break, as
> they did for me.

We don't use the MANIFEST file to generate the source trees for the releases
and all the last releases already contain the test folder.
So what exactly was your problem?

--


[Issue 14746] [REG2.068a] Behavior change with struct destructor and alias this

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14746

Martin Nowak  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||c...@dawg.eu
 Resolution|FIXED   |---

--- Comment #4 from Martin Nowak  ---
Same issue applies to postblitRecurse (which is used in std.conv).
We also wanted to replace the recursive templates with the new compiler
generated xdtor and xpostblit.

https://github.com/D-Programming-Language/druntime/pull/1313

I think a similar issue plagues all the hasElaborateX templates.

--


[Issue 14746] [REG2.068a] Behavior change with struct destructor and alias this

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14746

--- Comment #3 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/1a2290b1c36f8cdf66a9c4ce388b6a4b38ff9735
fix Issue 14746 - Behavior change with struct destructor and alias this

https://github.com/D-Programming-Language/druntime/commit/2f087248923ad77014259a52695f3abda076c206
Merge pull request #1312 from 9rnsr/fix14746

[REG2.068a] Issue 14746 - Behavior change with struct destructor and alias this

--


[Issue 14746] [REG2.068a] Behavior change with struct destructor and alias this

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14746

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 7910] Compiler gives error when post-contract is used in a function that returns from inside a loop

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7910

Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #2 from Kenji Hara  ---
Fortunately fixed in 2.067, by the change:
https://github.com/D-Programming-Language/dmd/pull/3979

--


[Issue 2350] Contracts with a naked body are indecent

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2350

Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Kenji Hara  ---
D1 is retired, so close as resolved fixed in D2.

--


[Issue 6417] Wrong context for nested functions in virtual class member function contracts

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6417

Kenji Hara  changed:

   What|Removed |Added

 CC||viritrilbi...@gmail.com

--- Comment #5 from Kenji Hara  ---
*** Issue 6118 has been marked as a duplicate of this issue. ***

--


[Issue 6118] nested overloaded foreach in contract crashes dmd

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6118

Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #3 from Kenji Hara  ---


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

--


[Issue 9383] Wrong context for contracts if closure [dis]appears in override function

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9383

--- Comment #3 from Kenji Hara  ---
*** Issue 9897 has been marked as a duplicate of this issue. ***

--


[Issue 9897] Wrong context for nested class inside virtual or final function with contract which uses `this`

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9897

Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Kenji Hara  ---
The class D in C.foo captures 'this' variable on stack, due to access C.ch from
D, then it makes C.foo a closure.

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

--


[Issue 13339] Address of parameter wrong in out contract

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13339

Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #6 from Kenji Hara  ---


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

--


[Issue 9383] Wrong context for contracts if closure [dis]appears in override function

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9383

Kenji Hara  changed:

   What|Removed |Added

 CC||tim.dl...@t-online.de

--- Comment #2 from Kenji Hara  ---
*** Issue 13339 has been marked as a duplicate of this issue. ***

--


[Issue 13463] Post-blit constructor not called for "out" contract when returning struct

2015-07-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13463

Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #1 from Kenji Hara  ---
Fixed in 2.067.

--