[Issue 24010] Destructor called before end of scope for tuples

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24010

--- Comment #6 from Dlang Bot  ---
@WalterBright created dlang/dmd pull request #15366 "fix Issue 24010 -
Destructor called before end of scope for tuples" fixing this issue:

- fix Issue 24010 - Destructor called before end of scope for tuples

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

--


[Issue 24021] Issue a warning on assert with side effects

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24021

Tim  changed:

   What|Removed |Added

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

--- Comment #5 from Tim  ---
This seems to be a duplicate of issue 12028.

--


[Issue 24021] Issue a warning on assert with side effects

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24021

mhh  changed:

   What|Removed |Added

 CC||maxha...@gmail.com

--- Comment #4 from mhh  ---
Pretty sure warnings have been added.

--


[Issue 24022] ImportC: Error: attribute `__anonymous` is used as a type

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24022

--- Comment #1 from Dlang Bot  ---
@katyukha created dlang/dmd pull request #15365 "Implement test case for Issue
24022" mentioning this issue:

- Implement test case for Issue 24022

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

--


[Issue 24021] Issue a warning on assert with side effects

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24021

Nick Treleaven  changed:

   What|Removed |Added

 CC||n...@geany.org

--- Comment #3 from Nick Treleaven  ---
Also asserts are used in unit tests where having side effects is often
deliberate.

--


[Issue 15542] pure function with no argument returning different values (with void-initialized static array)

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15542

RazvanN  changed:

   What|Removed |Added

 CC||j...@thefirst.org

--- Comment #9 from RazvanN  ---
*** Issue 14823 has been marked as a duplicate of this issue. ***

--


[Issue 14823] pure function returns uninitialized value

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14823

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |DUPLICATE

--- Comment #1 from RazvanN  ---


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

--


[Issue 24022] ImportC: Error: attribute `__anonymous` is used as a type

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24022

Dmytro Katyukha  changed:

   What|Removed |Added

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

--


[Issue 23662] ImportC bad handling of enum arguments for a function

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23662

Dmytro Katyukha  changed:

   What|Removed |Added

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

--


[Issue 24022] New: ImportC: Error: attribute `__anonymous` is used as a type

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24022

  Issue ID: 24022
   Summary: ImportC: Error: attribute `__anonymous` is used as a
type
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: firemage.d...@gmail.com

Hi,

This issue is related to Issue 23662.

Minimal example
===

```c
// testlib.c
typedef enum {
A = 1,
} E;
```

```d
// test.d
import testlib;

auto some_d_func(E v) {
return v;
}

void main(string[] args) {
E expected = A;
auto res = some_d_func(A);
assert (res == A);
assert (res == expected);
}

```

This example produces following error:

```
dmd test.d testlib.c
test.d(3): Error: attribute `__anonymous` is used as a type
```

Other example
=

```c
// testlib.c
typedef enum {
A = 1,
} E;
```

```d
// test2.d
import testlib;

auto some_d_other_func() {
const struct R {
E r;

this(in E vparam) {
r = vparam;
}
}

return R(A);
}

void main(string[] args) {
E expected = A;
auto res = some_d_other_func(A);
assert (res.r == A);
assert (res.r == expected);
}
```

This example produces following error:

```
dmd test2.d testlib.c
test2.d(5): Error: attribute `__anonymous` is used as a type
test2.d(7): Error: attribute `__anonymous` is used as a type
test2.d(16): Error: attribute `__anonymous` is used as a type
```


Real example with libpq
===

```c
//libpq.c
#include 
#include 
```

```d
// sample code from some d file.
@safe struct Result {
// ...
auto status() {
const struct ResultStatus {
ExecStatusType statusType;

this(in ExecStatusType statusType) {
this.statusType = statusType;
}

/// Return string representation of result status
string toString() const {
return PQresStatus(statusType).fromStringz.idup;
}
}

return ResultStatus(PQresultStatus(_result._pg_result));
}
}  
// 
```

--


[Issue 24022] ImportC: Error: attribute `__anonymous` is used as a type

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24022

Dmytro Katyukha  changed:

   What|Removed |Added

   Keywords||ImportC
 CC||firemage.d...@gmail.com

--


[Issue 24021] Issue a warning on assert with side effects

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24021

--- Comment #2 from RazvanN  ---
This could be implemented by a third party tool using dmd as a library. But I
don't think it should be implemented in the compiler.

--


[Issue 24021] Issue a warning on assert with side effects

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24021

RazvanN  changed:

   What|Removed |Added

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

--- Comment #1 from RazvanN  ---
Note: Walter is against issuing warnings. The compiler should either accept or
reject your code. A warning is something vague that programmers usually ignore
(against what best practices advice). In the last 7 years there were exactly 0
warning added to the compiler.

With that being said, there is no way such code is ever going to be an error.
That would mean that any function that receives an out parameter (or a
pointer/ref parameter) would have to issue an error if used in an assert. That
is very restrictive.

Even if it were issued as a measly warning, I don't really see the usefulness
of it. Asserts have the purpose to test for a specific condition, in this
particular case, that a function returns a specific value. Why would a warning
be issued if a function receives a pointer parameter? What's the actionable
item for this message? Stop using the assert?

--


[Issue 24021] New: Issue a warning on assert with side effects

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24021

  Issue ID: 24021
   Summary: Issue a warning on assert with side effects
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: grimmapl...@gmail.com

Consider this code:

```
bool fn(out int a)
{
a = 10;
return true;
}

void main()
{
int a;
assert(fn(a));
writeln(a);
}
```

This code will behave differently in Release and Debug builds. I suggest
issuing a warning for the user, when caling functions with side-effects inside
an assertion. I'm aware of 6074, and I'm not talking about changing how asserts
work, but it would be great to have a warning about this.

--


[Issue 15148] Linker error with packages

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15148

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |WORKSFORME

--- Comment #3 from RazvanN  ---
This now fails with:

```
app.d(5): Error: undefined identifier `a`

```

So it is no longer an error.

--


[Issue 15436] Compiler still refers to AliasSeq-s as "tuple"-s (and TypeTuple?)

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15436

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@ntrel created dlang/dmd pull request #15363 "Fix Issue 15436 - Compiler still
refers to AliasSeq-s as "tuple"-s" fixing this issue:

- Fix Issue 15436 - Compiler still refers to AliasSeq-s as "tuple"-s

  Replace "tuple type" with "type sequence".
  Replace "tuple" with "sequence".
  Pretty print `AliasSeq!(args)`, not `tuple(args)`.
  Leave json as "tuple" for now.
  Also mention std.typecons.Tuple when trying to return a sequence.

  Note: This does not rename any internal compiler symbols.

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

--


[Issue 15288] The precedence of the exponentiation operator ^^ is too high.

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15288

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |WONTFIX

--- Comment #3 from RazvanN  ---
Yes, we are far too late in the game to be doing such precedence changes now.

--


[Issue 20148] void initializated bool can be both true and false

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20148

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #5 from Dlang Bot  ---
@dkorpel created dlang/dmd pull request #15362 "Fix 20148 - void initializated
bool can be both true and false" fixing this issue:

- Fix 20148 - void initializated bool can be both true and false

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

--


[Issue 15324] symbol is already defined / size of symbol changed

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15324

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |WORKSFORME

--- Comment #8 from RazvanN  ---
I now get a compiler error using the latest version of the compiler for both
the reduced example provided in comment 1
(https://issues.dlang.org/show_bug.cgi?id=15324#c1) and for the extra-reduced
example provided in comment 5
(https://issues.dlang.org/show_bug.cgi?id=15324#c1). The error is:

test.d(9): Error: function
`test.MultiIndexContainer!().MultiIndexContainer.contains(int k)` conflicts
with previous declaration at test.d(3)
test.d(17): Error: template instance `test.MultiIndexContainer!()` error
instantiating

So the compiler now catches this case. Closing as WORKSFORME.

--


[Issue 23993] std.algorithm.maxElement no longer works with array of BigInt

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23993

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #3 from Dlang Bot  ---
dlang/phobos pull request #8764 "Fix issue 23993: Discard Rebindable before
passing extremum to compar…" was merged into stable:

- f715941036c10ae1664f0afa3566084f0d6ee524 by FeepingCreature:
  Fix issue 23993: Discard Rebindable before passing extremum to comparator.

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

--


[Issue 15355] unstable operator overloading with comma expression

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15355

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |WONTFIX

--- Comment #4 from RazvanN  ---
The comma operator is not supported anymore in the frontend. The code now
yields:

test.d(24): Error: using the result of a comma expression is not allowed

--


[Issue 24019] Public alias to private struct template in struct instantiated in UDA is not visible from module

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24019

--- Comment #1 from FeepingCreature  ---
Hm. I'm not actually convinced this is a _bug_.

We have a public alias, but the alias goes to a private template, and we
instantiate the template from outside via the alias.

The template has a private member... that member is found *via* the alias, but
is not itself anywhere marked as public. If we write it out:

```
struct S {
public alias A = T;
}
private template T() {
private struct T {}
}
...
@(S.A!().T)
void main() { }
```

It's not at all obvious that this is erroring wrongly.

--


[Issue 11612] Inconsistent error on negative new array size

2023-06-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11612

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #5 from Dlang Bot  ---
dlang/dmd pull request #15359 "Fix Issue 11612 - Inconsistent error on negative
new array size" was merged into master:

- b02ed4b9c759fbc1b4fee9a4a0cc7d00095792ce by Nick Treleaven:
  Fix Issue 11612 - Inconsistent error on negative new array size

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

--