[Issue 17766] Wrong choice of generic mutable/const/immutable methods

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17766

alexandru.ermic...@gmail.com changed:

   What|Removed |Added

 CC||alexandru.ermic...@gmail.co
   ||m

--- Comment #1 from alexandru.ermic...@gmail.com ---
This is not the only case, here is another case of wrong selection:

--
class Mquartz(T, Z) {
Z pass(T component) const {
"Mutable pass".writeln;
return component.z;
}
const(Z) pass(const T component) const {
"Const pass".writeln;
return component.z;
}
const(Z) pass(immutable T component) const {
"Immutable pass".writeln;
return component.z;
}
const(Z) pass(inout T component) const {
"Inout pass".writeln;
return component.z;
}
}

struct V {
int z;
}

void main() {

auto m = new Mquartz!(V, typeof(V.z));

// V v = V(21);
// writeln(m.pass(v));
writeln(m.pass(V(20)));
writeln(m.pass(const(V)(20)));
writeln(m.pass(immutable(V)(20)));
writeln(m.pass(inout(V)(20)));
}
-
Current logic will select only const version with const argument instead of
selecting right ones:
-
Const pass
20
Const pass
20
Const pass
20
Const pass
20
-
The overload selection logic works as expected only if m is const, then
response will as expected:
-
Mutable pass
20
Const pass
20
Immutable pass
20
Inout pass
20
-

--


[Issue 19326] .tupleof sidesteps protection attributes

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19326

Jacob Carlborg  changed:

   What|Removed |Added

 CC||d...@me.com

--- Comment #1 from Jacob Carlborg  ---
I don't consider this a bug, I consider this a feature.

--


[Issue 18896] extern(C++) always mangles classes as pointer

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18896

--- Comment #1 from Mathias LANG  ---
Renamed to make it a bit more generic.
This is also a problem when `ref` is used for passing the class around.
E.g. `foo(MyClass&)` cannot be represented in D, which is very limiting.

--


[Issue 18896] extern(C++) always mangles classes as pointer

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18896

Mathias LANG  changed:

   What|Removed |Added

 CC||pro.mathias.l...@gmail.com
Summary|extern(C++) template with   |extern(C++) always mangles
   |class argument mangling |classes as pointer

--


[Issue 19260] extern(C++) `T* const` mangling

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19260

Mathias LANG  changed:

   What|Removed |Added

 CC||pro.mathias.l...@gmail.com

--- Comment #7 from Mathias LANG  ---
I strongly agree with Kinke here and think we should not pursue mangling head
const, as it's already possible to do it with a small hack (and it's a one-time
cost).

--


[Issue 15473] C++ mangling problem

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15473

Mathias LANG  changed:

   What|Removed |Added

 CC||pro.mathias.l...@gmail.com

--- Comment #7 from Mathias LANG  ---
Do you still see this ? Without a proper way to reproduce, I don't know what we
can do about this bug.

--


[Issue 15387] slice in extern(C++) ICE's

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15387

Mathias LANG  changed:

   What|Removed |Added

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

--- Comment #2 from Mathias LANG  ---
It does not crash the compiler anymore, but print ICE. 
See https://issues.dlang.org/show_bug.cgi?id=18716

--


[Issue 17975] D produces mangling incompatible with C++

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17975

Mathias LANG  changed:

   What|Removed |Added

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

--- Comment #2 from Mathias LANG  ---
Indeed, it's a transitive const issue.
We should properly document how to bind C++ to D (as not all code can be), but
that's another issue. Closing as invalid.

--


[Issue 16479] Missing substitution while mangling C++ template parameter for functions

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16479

Mathias LANG  changed:

   What|Removed |Added

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

--- Comment #8 from Mathias LANG  ---
*** Issue 16944 has been marked as a duplicate of this issue. ***

--


[Issue 16944] extern(C++) with template produces wrong mangleof

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16944

Mathias LANG  changed:

   What|Removed |Added

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

--- Comment #1 from Mathias LANG  ---
Duplicate of 16479 (for which there is a pull)

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

--


[Issue 15970] C++ mangling of templated arg type

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15970

Mathias LANG  changed:

   What|Removed |Added

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

--- Comment #5 from Mathias LANG  ---
Marking as a duplicate of 16479, which is older, but for which there is a PR.
I just tried it with PR 8455 and it gets mangled correctly:
```
../../install/osx/bin/dmd -c lol.d; nm lol.o | c++filt
[...]
04c8 S A::foo_template(int)
0040 S A::foo_template(int) (.eh)
04d0 S A::foo_incorrect(Symbol*)
0068 S A::foo_incorrect(Symbol*) (.eh)
```

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

--


[Issue 16479] Missing substitution while mangling C++ template parameter for functions

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16479

Mathias LANG  changed:

   What|Removed |Added

 CC||jbc.enge...@gmail.com

--- Comment #7 from Mathias LANG  ---
*** Issue 15970 has been marked as a duplicate of this issue. ***

--


[Issue 19326] New: .tupleof sidesteps protection attributes

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19326

  Issue ID: 19326
   Summary: .tupleof sidesteps protection attributes
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: critical
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: simen.kja...@gmail.com

module foo;
struct S {
private int i;
}

module bar;
import foo;
@safe unittest {
S s;
// Fails: struct `foo.S` member i is not accessible
s.i++;
// Fails: struct `foo.S` member i is not accessible
__traits(getMember, s, "i")++;
// Compiles just fine:
s.tupleof[0]++;
}

This breaks guarantees about what's accessible from other modules, and can be
used to break invariants relied on in @trusted code.

At the very least, this should not be @safe.

Related: issue 15371

--


[Issue 18290] std.conv.parse throws ConvOverflowException for negative values in hex

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18290

--- Comment #2 from Răzvan Ștefănescu  ---
(In reply to Tiberiu Lepadatu from comment #1)
> (In reply to Răzvan Ștefănescu from comment #0)
> > string input = "8000";
> > auto x = parse!int(input, 16);
> > //ConvOverflowException
> 
> I feel that this is not a bug. To show that you
> are using a hex string you must use "0x" in front.
> If you write "0x8000" instead of "8000"
> there is no bug.

parsing 0x8000 will read only the "0" before x, which is not the intended
behavior, therefore x will become 0, not -2147483648.

In order to show that I am using a hex string, I specify the radix (16). To go
further, how do I parse a string with radix 7? How do I prefix the string?

--


[Issue 4957] std.concurrency does not allow to pass Tid in struct fields

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4957

Mathias LANG  changed:

   What|Removed |Added

 CC||pro.mathias.l...@gmail.com

--- Comment #5 from Mathias LANG  ---
New attempt: https://github.com/dlang/phobos/pull/6738

--