[Issue 20805] C++ mangling mismatch with templates and namespaces

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20805

Mathias LANG  changed:

   What|Removed |Added

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

--- Comment #3 from Mathias LANG  ---
Actually, the reduction is a different issue. C++ does not have parameterless
templates, so the compiler should probably disallow them since it can't mangle
them.

--


[Issue 22016] [REG2.067] Wrong code with enum comparison in void ternary with side effects

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22016

Ketmar Dark  changed:

   What|Removed |Added

 CC||ket...@ketmar.no-ip.org

--


[Issue 20393] formattedRead accepts input, that should be rejected

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20393

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@taitaisama created dlang/phobos pull request #8144 "Fix Issue 20393 -
formattedRead accepts input, that should be rejected" fixing this issue:

- Fix Issue 20393 - formattedRead accepts input, that should be rejected

https://github.com/dlang/phobos/pull/8144

--


[Issue 22022] A function with pragma(mangle) mixed into a function body is missing from the binary

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22022

Mathias LANG  changed:

   What|Removed |Added

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

--- Comment #1 from Mathias LANG  ---
Confirmed. Trying to call it from the scope of main also triggers a linker
error on OSX. Sounds like a missing override in a visitor.

--


[Issue 22025] Exception within a delegate can't be thrown.

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22025

--- Comment #2 from Mathias LANG  ---
Note that this is yet another DMD-specific bug, compiling with LDC works.

--


[Issue 22025] Exception within a delegate can't be thrown.

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22025

Mathias LANG  changed:

   What|Removed |Added

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

--- Comment #1 from Mathias LANG  ---
Reproduced.

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=2, address=0x1003c7c00)
  * frame #0: 0x7fff2032f50c libsystem_pthread.dylib`___chkstk_darwin + 96
frame #1: 0x7fff2032f4ac libsystem_pthread.dylib`thread_start + 20
frame #2: 0x7fff2a4adb2d
libunwind.dylib`libunwind::UnwindCursor::getInfoFromDwarfSection(unsigned long,
libunwind::UnwindInfoSections const&, unsigned int) + 191
frame #3: 0x7fff2a4ada01
libunwind.dylib`libunwind::UnwindCursor::setInfoBasedOnIPRegister(bool) + 999
frame #4: 0x7fff2a4afec9
libunwind.dylib`libunwind::UnwindCursor::step() + 461
frame #5: 0x7fff2a4b1a18 libunwind.dylib`_Unwind_RaiseException + 189
frame #6: 0x00010005c0fd future`_d_throwdwarf + 185
frame #7: 0x00011e9d
future`_D4mainQfFZ9__lambda3MFNaNfiZi(__capture=0x00010060, x=30) at
object.d:2478
frame #8: 0x000100025aea
future`_D7toolkit7promise__T9asyncImplTDFNaNfiZiTiZQxFQpiZ9__lambda6MFZv(__capture=0x000100604030)
at promise.d:446
frame #9: 0x000100058d79
future`_D4core6thread7context8Callable6opCallMFZv + 41
frame #10: 0x000100055227 future`fiber_entryPoint + 99
```

I've been seeing this issue for a while:
https://github.com/dlang/dub/issues/2120

--


[Issue 22027] inout shouldn't imply return

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22027

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@dkorpel created dlang/dmd pull request #12689 "Fix issue 22027, 20149 - inout
doesn't imply return" fixing this issue:

- fix issue 22027, 20149 - inout doesn't imply return

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

--


[Issue 20149] [DIP1000] Local data escapes `inout` method if not decorated with `return`

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20149

--- Comment #24 from Dlang Bot  ---
@dkorpel created dlang/dmd pull request #12689 "Fix issue 22027, 20149 - inout
doesn't imply return" fixing this issue:

- fix issue 22027, 20149 - inout doesn't imply return

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

--


[Issue 22027] New: inout shouldn't imply return

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22027

  Issue ID: 22027
   Summary: inout shouldn't imply return
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: safe
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dkor...@live.nl

Currently `inout` parameters imply the `return` attribute. It's a special case,
adding complexity to the language and the compiler, and it doesn't make sense.
The rationale of it is:

> The idea is that the inout doesn't make sense if one is not returning 
> something based on the parameter marked with inout.
https://github.com/dlang/dmd/pull/10390#issuecomment-528774351

However, as pointed out by Rainer Schuetze, it's possible to return something
else that has the same qualifier as the parameter but different lifetime.

```
struct Large { void[4000] data; }
struct SImpl
{
   Large d;
}
struct S
{
   SImpl* impl; // GC managed?
   ref inout(Large) getLarge() inout { return impl.d; }
}

```
https://github.com/dlang/dmd/pull/10390#issuecomment-529177731

In fact, here are examples of valid uses of inout with every combination of
ref/return/scope, showing that it doesn't ever imply the need for `return`:
```
struct Node
{
int x;
Node* next;
inout(int*) next_v0() return   inout {return }
inout(int*) next_v1() return scope inout {return }
inout(int*) next_v2()scope inout {return }
inout(int*) next_v3()  inout {return }

ref inout(int) next_r0() return   inout {return this.next.x;}
ref inout(int) next_r1()scope inout {return this.next.next.x;}
ref inout(int) next_r2() return scope inout {return this.next.next.x;}
ref inout(int) next_r3()  inout {return this.next.x;}
}

inout(int*) next_v0(return   inout Node this_) {return _.next.x;}
inout(int*) next_v1(return scope inout Node this_) {return _.next.x;}
inout(int*) next_v2(   scope inout Node this_) {return _.next.next.x;}
inout(int*) next_v3( inout Node this_) {return _.next.x;}

ref inout(int) next_r0(return   inout Node this_) {return this_.next.x;}
ref inout(int) next_r1(return scope inout Node this_) {return this_.next.x;}
ref inout(int) next_r2(   scope inout Node this_) {return
this_.next.next.x;}
ref inout(int) next_r3( inout Node this_) {return this_.next.x;}
```

It's also worth noting that the current implementation has a bug that's
trivially fixed by removing the special case:
https://issues.dlang.org/show_bug.cgi?id=20149

```
@safe:   
struct ScopeBuffer {
char[4] buf;
inout(char)[] getSlice() inout {return buf[];}
}

char[] fun() {
char[4] buf = "abcd";
ScopeBuffer sb = ScopeBuffer(buf);
return sb.getSlice; // dangling slice to stack memory is returned here
}

void main() {
auto s = fun();
}
```

--


[Issue 20149] [DIP1000] Local data escapes `inout` method if not decorated with `return`

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20149

Dennis  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=22027

--


[Issue 17927] [scope] `scope inout` parameter value can be escaped via return

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17927

Dennis  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=22027

--


[Issue 22026] checkaction=context: Exception thrown by toString hides assertion failures

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22026

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@MoonlightSentinel created dlang/druntime pull request #3499 "Fix 22026 - Catch
exceptions thrown by user-defined toString methods... " fixing this issue:

- Fix 22026 - Catch exceptions thrown by user-defined toString methods...

  ... when formatting values for `-checkaction=context` and print the
  aggregate members as a fallback. This ensures that an unrelated error
  does not mask the assertion failure.

https://github.com/dlang/druntime/pull/3499

--


[Issue 22026] New: checkaction=context: Exception thrown by toString hides assertion failures

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22026

  Issue ID: 22026
   Summary: checkaction=context: Exception thrown by toString
hides assertion failures
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: moonlightsenti...@disroot.org

checkaction=context calls user-defined toString-methods if defined. But those
can throw an exception which masks the real assertion failure, e.g.:

truct MayThrow
{
int i;
string toString()
{
if (i == 1)
throw new Exception("Error");
return "Some message";
}
}

assert(MayThrow(0) == MayThrow(1));


This test will report the exception from toString(), not the assertion failure.

--


[Issue 22018] pragma(inline) parameter not checked when the pragma is a declaration

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22018

moonlightsenti...@disroot.org changed:

   What|Removed |Added

 CC||moonlightsentinel@disroot.o
   ||rg
 Resolution|INVALID |WONTFIX

--


[Issue 22018] pragma(inline) parameter not checked when the pragma is a declaration

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22018

RazvanN  changed:

   What|Removed |Added

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

--- Comment #2 from RazvanN  ---
Looking at the dmd source code it seems that this is on purpose [1]. Closing as
invalid.

[1] https://github.com/dlang/dmd/blob/master/src/dmd/dsymbolsem.d#L1631

--


[Issue 22018] pragma(inline) parameter not checked when the pragma is a declaration

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22018

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
I'm not sure this is a bug. Since the declaration is missing, the pragma is no
longer semantically analyzed.

--


[Issue 21951] Segfault on `noreturn.init`

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21951

--- Comment #2 from Dlang Bot  ---
@RazvanN7 updated dlang/dmd pull request #12688 "Fix Issue 22017 - with() on
struct method that returns this destroys too early" fixing this issue:

- Fix 21951 - Add missing defaultInit literal for `noreturn`

  Otherwise further semantic for `noreturn` variables / overload resultion
  will segfault.

  The default initializer is defined as `assert(false)` for now. This
  might need to be revised to satisfy [1] once the backend is adapted to
  handle `noreturn` outside of return values (currently either crashes or
  hits assertion failures).

  [1]:
  > Defining a noreturn variable with no initialization expression
  > generates an assert(0) only if the variable is accessed, which can be
  > useful in generic code where unused noreturn variables may be declared

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

--


[Issue 22017] with() on struct method that returns this destroys too early

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22017

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #2 from Dlang Bot  ---
@RazvanN7 created dlang/dmd pull request #12688 "Fix Issue 22017 - with() on
struct method that returns this destroys too early" fixing this issue:

- Fix Issue 22017 - with() on struct method that returns this destroys too
early

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

--


[Issue 22024] hashOf does not work on enum types whose base type is a SIMD vector

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22024

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #2 from Dlang Bot  ---
dlang/druntime pull request #3497 "[stable] hashOf does not work on enum types
whose base type is a SIMD vector" was merged into stable:

- 4aa8c47d8fee3f2389dcb4408412a307d15b0393 by Nathan Sashihara:
  Fix Issue 22024 - hashOf does not work on enum types whose base type is a
SIMD vector

  Also incidentally do not pass vector by ref to toHash

https://github.com/dlang/druntime/pull/3497

--


[Issue 22025] New: Exception within a delegate can't be thrown.

2021-06-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22025

  Issue ID: 22025
   Summary: Exception within a delegate can't be thrown.
   Product: D
   Version: D2
  Hardware: x86_64
OS: Mac OS X
Status: NEW
  Severity: critical
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: bitwo...@qq.com

When throwing an exception within a delegate, the app crashed.

My OS is macOS Big Sur 11.4. It's OK in Linux.

Tested compilers: DMD 2.088.1 - 2.097.0

Here is the sample:

```
void main() {
int factor = 2;
auto ex2a = new Promise!int();

auto ex2b = ex2a.then!(async!((int x) { 
if(x == 30) {
// It's a bug in macOS Big Sur 11.4
throw new Exception("throw an exception!");
}
return x * factor; 
}));

ex2a.resolve(30); // throw an exception!
}
```

The steps are here for reproducing this bug:

```
$ git clone https://github.com/Heromyth/future.git
$ cd future
$ dub run
```

--