[Issue 19888] New: default parameters in templates with tuple parameters+defaults are thrown away

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19888

  Issue ID: 19888
   Summary: default parameters in templates with tuple
parameters+defaults are thrown away
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: elpenguin...@gmail.com

This example fails to compile on all known DMD versions.
```
unittest {
assert(func(1,0) == 1);
assert(func(1) == 1); //compile error
assert(func2() == 0);
}
template AliasSeq(TList...)
{
alias AliasSeq = TList;
}
T func(T)(T value, AliasSeq!(int) params = AliasSeq!(0))
{
return value;
}
int func2(AliasSeq!(int) params = AliasSeq!(0))
{
return 0;
}
```

--


[Issue 19887] New: Segfault with void tuple default parameter

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19887

  Issue ID: 19887
   Summary: Segfault with void tuple default parameter
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: elpenguin...@gmail.com

This code causes the compiler to segfault as of DMD 2.084.1. This did not occur
in 2.083.1 and earlier. I did not test with 2.084.0.
```
void func(AliasSeq!(int) params = AliasSeq!(void)) {}

template AliasSeq(TList...)
{
alias AliasSeq = TList;
}
```

--


[Issue 1012] cannot instantiate template with no or default arguments without !()

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1012

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |WONTFIX

--- Comment #12 from Mathias LANG  ---
The current error message is a bit better:
> test.d(9): Error: template class test.Bar(T = int) is used as a type without 
> instantiation; to instantiate it use Bar!(arguments)

Given that:
- This bug has been open for 12 years
- There is no consensus in the favor of this enhancement
- Walter Bright has spoken against it

It should clearly go through the DIP process to properly assess if there would
be any corner cases, semantic or parsing wise.

--


[Issue 704] `class` destructor is called even if constructor throws

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=704

Mathias LANG  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |FIXED

--- Comment #15 from Mathias LANG  ---
The dtor of scope allocated classes is not called anymore.

--


[Issue 1142] .stringof performs semantic analysis

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1142

Mathias LANG  changed:

   What|Removed |Added

 CC||pro.mathias.l...@gmail.com
   Hardware|x86 |All
Version|D1 (retired)|D2

--- Comment #3 from Mathias LANG  ---
Still an issue in D2.

--


[Issue 1164] Unordered GC finalization leading to memory bugs

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1164

Mathias LANG  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |WONTFIX

--- Comment #16 from Mathias LANG  ---
We advertise everywhere that you should not access GC-allocated items in
destructors, but you can access anything that is allocated with another method.
Just like you should not allocate in destructors.

Closing this, as it is not actionable.
Anything addressing this should be a DIP, as we have gathered over a decade of
experience with this problem.

--


[Issue 1162] Access to static field in inherited class is not possible with base class qualifier.

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1162

Mathias LANG  changed:

   What|Removed |Added

 CC||pro.mathias.l...@gmail.com
   Hardware|x86 |All
Version|D1 (retired)|D2

--- Comment #2 from Mathias LANG  ---
This is still very much valid as of DMD 2.086.

--


[Issue 1181] DMD requires initializer for struct that shouldn't need one

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1181

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |FIXED

--- Comment #3 from Mathias LANG  ---
Works in D2 now

--


[Issue 1511] Expression T[] + T[] passes as having a type

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1511

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |FIXED

--- Comment #8 from Mathias LANG  ---
It fails now.

--


[Issue 2172] statically disallow bool + bool

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2172
Issue 2172 depends on issue 1511, which changed state.

Issue 1511 Summary: Expression T[] + T[] passes as having a type
https://issues.dlang.org/show_bug.cgi?id=1511

   What|Removed |Added

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

--


[Issue 1324] __FILE__ in mixin template expand to the definition, not the instantiation

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1324

Mathias LANG  changed:

   What|Removed |Added

   Keywords|diagnostic  |
 CC||pro.mathias.l...@gmail.com
   Hardware|x86 |All
Version|D1 (retired)|D2
Summary|Wrong module name in|__FILE__ in mixin template
   |exception when using mixin  |expand to the definition,
   ||not the instantiation
 OS|Windows |All

--- Comment #1 from Mathias LANG  ---
Edited the issue title to make the current problem more obvious.
The original code uses ranges access to trigger an exception, which are errors
(not exception in D2).

The actual bug, can be illustrated by those 2 files:

/ t1.d /
module t1;
import t2;
import std.stdio;
void main()
{
mixin mixinT2!();
testT2();
}

/ t2.d /
module t2;
template mixinT2()
{
  void testT2()
  {
  try
  throw new Exception("FromT2");
  catch(Exception e)
  writefln("T2: caught exception in %s: '%s'", __FILE__, e.toString);
  }
}

///
Running this code:

dmd t2.d -run t1.d
T2: caught exception in t2.d: 'object.Exception@t2.d(8): FromT2

??:? void t1.main().__mixin1.testT2(int) [0x102b84f17]
??:? _Dmain [0x102b84afb]'


As the message shows, `__FILE__` expands to `t2.d`, both in the `writeln` call
and the default parameter for `Exception` ctor.
However, the specs currently mentions:
> __FILE__ and __LINE__ expand to the source file name and line number at the 
> point of instantiation. The path of the source file is left up to the 
> compiler.

It is not 100% clear to me if "point of instantiation" implies templates as
well, and thus not 100% clear if this is a bug and/or can be solved.

--


[Issue 1354] Can use function prototype in typedef and alias.

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1354

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |FIXED

--- Comment #3 from Mathias LANG  ---
Typedef is gone

--


[Issue 6856] Absence of in contract (precondition) on override of method that has one is badly designed

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6856

--- Comment #36 from Dlang Bot  ---
@ibuclaw updated dlang/dmd pull request #7510 "fix Issue 6856 - Use in contract
from base class if not specified in derived" fixing this issue:

- fix Issue 6856 - Use in contract from base class if not specified in derived

https://github.com/dlang/dmd/pull/7510

--


[Issue 19886] New: Bitfields template instantiation introduces unnecessary GOT symbol

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19886

  Issue ID: 19886
   Summary: Bitfields template instantiation introduces
unnecessary GOT symbol
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: alexandru.cmilit...@gmail.com

Bitfields template instantiation introduces unnecessary _GLOBAL_OFFSET_TABLE_
symbol. 

Because of this symbol, it is not possible to use D code inside the Linux
kernel. 

import std.bitmanip;

struct MyStruct
{
mixin(bitfields!(
uint, "x", 2,
uint, "", 6));

}

https://gist.github.com/alexandrumc/ce2363b4f344289e7c8386fa6c3d614d

--


[Issue 19575] core.cpuid not usable without a runtime

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19575

--- Comment #2 from ponce  ---
Well I want to use the core.cpuid in druntime, not the one in a library
rewrite. I also use a library rewrite, but other parts of Phobos are affected
by this lack of core.cpuid

Besides other problems of mir.cpuid:
- it depends on mir-core
- ...with a dependency version version="<0.3.0" which precludes bugfix for new
compilers, why not use ~> 
  In SemVer major version 0 means "unstable" which means mir-core doesn't have
a stability guarantee? If it has, please tag a v1.0.0
- mir-core and mir-cpuid are tested with current/latest LDC and DMD but I do
use older compilers all the time. I can't depend on a DUB package that will
break compiler that are less than one year ago.

--


[Issue 18958] extern(C++) wchar, dchar mangling not correct

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18958

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #4 from Dlang Bot  ---
@TurkeyMan updated dlang/dmd pull request #8342 "Fix Issue 18958 - extern(C++)
wchar, dchar mangling not correct" fixing this issue:

- Fix Issue 18958 - extern(C++) wchar, dchar mangling not correct

https://github.com/dlang/dmd/pull/8342

--


[Issue 10276] Nested structs with constructors get a context pointer even if they don't need one

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10276

Basile-z  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com

--


[Issue 15343] The compiler performs insufficient analysis to check if a structure is actually nested

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15343

Simen Kjaeraas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||simen.kja...@gmail.com
 Resolution|--- |DUPLICATE

--- Comment #1 from Simen Kjaeraas  ---


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

--


[Issue 10276] Nested structs with constructors get a context pointer even if they don't need one

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10276

Simen Kjaeraas  changed:

   What|Removed |Added

 CC||petar.p.ki...@gmail.com

--- Comment #3 from Simen Kjaeraas  ---
*** Issue 15343 has been marked as a duplicate of this issue. ***

--


[Issue 19584] Illegal optimization: Shift-or -> imul

2019-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19584

Suleyman Sahmi (سليمان السهمي)  changed:

   What|Removed |Added

 CC||sahmi.soulaim...@gmail.com

--- Comment #3 from Suleyman Sahmi (سليمان السهمي)  
---
Reduced to:

```
void main()
{
int a = 711;
assert(182215 == (a | (a << 8)));
assert(182727 == (a * (1 + (1 << 8;

int b = 31;
assert(511 == (b | (b << 4)));
assert(527 == (b * (1 + (1 << 4;
}
```

https://run.dlang.io/is/MjL0NG

--