[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

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

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #11 from Dlang Bot  ---
dlang/dmd pull request #16510 "fix issue24534 : goto can skip declarations in
labeled statements without error" was merged into master:

- 7f30b66d3dae37544c7629af1178f908984c2a93 by Ben Jones:
  Fix Bugzilla Issue 24534 : goto can skip declarations in labeled statements
without error

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

--


[Issue 24557] File.readln does not properly handle case where last character in terminator is repeated

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

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@gmail.com
   Hardware|x86_64  |All
 OS|Linux   |All

--- Comment #1 from Steven Schveighoffer  ---
readln does use the last character, but it is also validating the "line" ends
in the full termination sequence.

However, the bug is that if the last character is repeated in the termination
sequence, it checks just the new data that it has read for the termination
sequence.

So for example, if you look for `ging` as the termination sequence, the
following algorithm results (assume input is `bringing home the bacon`):

1. result = "", readln('g') => "bring". Does "bring" end in "ging"? no
2. result = "bring", readln('g') => "ing". Does "ing" end in "ging"? no
3. result = "bringing", readln('g') => " home the bacon". readln returned no
delim found, so result is "bringing home the bacon"

Instead, readln should check the *concatenated* result (but obviously, only the
result that has been appended since the readln call was started.

--


[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

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

--- Comment #10 from Ben  ---
"Since this is used in C code quite often, and therefore ported code (such as
dmd's backend)."  

>From what I can tell, there's only one place in the whole compiler that's
affected by this bug, so I don't think this is something that was commonly
relied on.

--


[Issue 24557] New: File.readln does not properly handle case where last character in terminator is repeated

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

  Issue ID: 24557
   Summary: File.readln does not properly handle case where last
character in terminator is repeated
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: zopsi...@use.startmail.com

Consider the following program:

-
import std.stdio : readln, writefln;

void main()
{
char[] buf;
readln(buf, "ABA");
writefln!"%(%s%)"([buf]);
}
-

Compiled and run as follows:

-
$ dmd example.d
$ printf 'XABAY' | ./example
-

Expected output: "XABA"
Actual output: "XABAY"

readln does not properly handle the case where the last character of the
terminator (in this case A) appears multiple times in the terminator (in this
case, A also appears at the front of the terminator).

--


[Issue 24556] New: Allow IFTI for dotted template parameters used as function type parameter

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

  Issue ID: 24556
   Summary: Allow IFTI for dotted template parameters used as
function type parameter
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: b2.t...@gmx.com

Minor enhancement, not very useful but maybe that this should work:

```d
version(all) 
void v(T,U)(T.U tu){}
else 
   void v(U, T = __traits(parent, U))(U tu){}; // that works fine RN

void main()
{
struct S1 { S2 s2; struct S2 {} }
S1 s1;
v(s1.s2);

struct G1 { struct G2 {} }
G1.G2 g1g2;
v(g1g2);
} 
```

That is currently rejected but the compiler could guess that `U` is either `S2`
or `G2` and then infer `T` as being the parent type (if any). That would be
similar to the case where D deduces T, let's say in `void v(T)(T[] t)`.

--