[Issue 18831] Weird interaction between std.variant, std.algorithm.iteration.map, and alias this

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

--- Comment #1 from |  ---
Some notes on paring it down:

* Omitting the call to map makes this compile.
* Omitting the alias this makes it compile.
* You don't actually need a struct Bar; `map!(x => x)` is enough.
* You can use an array instead of iota.
* Replacing the lambda parameter with a top-level function (map!identity)
changes the error to:
/home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7784): Error:
function algebraicaliasthis.identity(string s) is not callable using argument
types ()
/home/dhasenan/.local/bin/../include/phobos/std/meta.d(799): Error: template
instance `std.typecons.ReplaceType!(This, VariantN!(1LU, Foo),
Foo).F!(identity)` error instantiating
/home/dhasenan/.local/bin/../include/phobos/std/meta.d(805):   
instantiated from here: staticMap!(replaceTemplateArgs, identity)
/home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7788):   
instantiated from here: staticMap!(replaceTemplateArgs, identity, string[])
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(103):   
instantiated from here: ReplaceType!(This, VariantN!(1LU, Foo), Foo)
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(137):   
instantiated from here: This2Variant!(VariantN!(1LU, Foo), Foo)
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(1500):   
instantiated from here: VariantN!(1LU, Foo)
algebraicaliasthis.d(16):instantiated from here: Algebraic!(Foo)

--


[Issue 18831] New: Weird interaction between std.variant, std.algorithm.iteration.map, and alias this

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

  Issue ID: 18831
   Summary: Weird interaction between std.variant,
std.algorithm.iteration.map, and alias this
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: dhase...@gmail.com

---
import std.variant, std.range, std.algorithm;

struct Bar
{
int i;
}

struct Foo
{
auto i()
{
return iota(12)
.map!(x => Bar(x));
}
alias i this;
}

void main()
{
Foo controlGroup = Foo();
Algebraic!(Foo) treatmentGroup = Foo();
}
---

The control group works without errors. The treatment group fails with:

/home/dhasenan/.local/bin/../include/phobos/std/meta.d(799): Error: template
instance `F!(__lambda1)` cannot use local __lambda1 as parameter to non-global
template replaceTemplateArgs(T...)
/home/dhasenan/.local/bin/../include/phobos/std/meta.d(805): Error: template
instance `algebraicaliasthis.Foo.i.staticMap!(replaceTemplateArgs, __lambda1)`
error instantiating
/home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7788):   
instantiated from here: staticMap!(replaceTemplateArgs, __lambda1, Result)
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(103):   
instantiated from here: ReplaceType!(This, VariantN!(1LU, Foo), Foo)
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(137):   
instantiated from here: This2Variant!(VariantN!(1LU, Foo), Foo)
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(1500):   
instantiated from here: VariantN!(1LU, Foo)
algebraicaliasthis.d(20):instantiated from here: Algebraic!(Foo)

--


[Issue 5034] Ranged (or bounded) array initializer

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

greenify  changed:

   What|Removed |Added

 CC||greeen...@gmail.com

--- Comment #3 from greenify  ---
We will have staticArray in Phobos soon which will greatly help in doing this
purely as a library. Though this obviously could already been done easily as a
library today.
This is definitely very unlikely to end up in the language.

--


[Issue 13507] std.range.enumerate with BigInt indexes too

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

--- Comment #1 from Seb  ---
PR in progress: https://github.com/dlang/phobos/pull/6496

--


[Issue 18830] Document Allowance for "new" with "scope" in @nogc Functions

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

greenify  changed:

   What|Removed |Added

 CC||greeen...@gmail.com

--- Comment #1 from greenify  ---
FWIW scope & new will result in an allocation on the stack, though I agree that
this should be properly documented.

--


[Issue 15437] documentation for typeof(someTemplate) == void

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

--- Comment #8 from Johannes Loher  ---
Realated comment in the corresponding section in dmd:

/* Today, 'typeof(func)' returns void if func is a
 * function template (TemplateExp), or
 * template lambda (FuncExp).
 * It's actually used in Phobos as an idiom, to branch code for
 * template functions.
 */

Does anybody know where this is actually used in phobos? Wouldn't it be better
to use isTemplate in this case?

--


[Issue 15437] documentation for typeof(someTemplate) == void

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

Andrei Alexandrescu  changed:

   What|Removed |Added

   Keywords||preapproved

--- Comment #7 from Andrei Alexandrescu  ---
preapproved

--


[Issue 7947] typeof on anonymous function literal returns void

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

Johannes Loher  changed:

   What|Removed |Added

 CC||johannes.lo...@fg4f.de

--- Comment #4 from Johannes Loher  ---
Related: https://issues.dlang.org/show_bug.cgi?id=15437

I briefly talked to both Andrei and Walter today at dconf about this. They both
agreed, that calling typeof on a template should be an error (similiar to how
calling typeof on a type is an error).

Any thoughts on that?

--


[Issue 15437] documentation for typeof(someTemplate) == void

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

Johannes Loher  changed:

   What|Removed |Added

 CC||johannes.lo...@fg4f.de

--- Comment #6 from Johannes Loher  ---
Related: https://issues.dlang.org/show_bug.cgi?id=7947

I briefly talked to both Andrei and Walter today at dconf about this. They both
agreed, that calling typeof on a template should be an error (similiar to how
calling typeof on a type is an error).

Any thoughts on that?

--


[Issue 10919] typeof should accept types

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

Johannes Loher  changed:

   What|Removed |Added

 CC||johannes.lo...@fg4f.de

--- Comment #4 from Johannes Loher  ---
It has been a long time since this has seen any attention, but I also agree
with Timon. How should we go forward with this one? I highly doubt, it will
ever be implemented and if so, it might need a DIP?

--


[Issue 6318] module isn't fully processed under weird conditions

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

Basile B.  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com
 Resolution|FIXED   |WORKSFORME

--- Comment #5 from Basile B.  ---
Please use WORKSFORME as resolution when you see it works now but don't know
exactly why or which PR solved the issue.

--


[Issue 18623] Documented unittest should not allow private symbol access

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

--- Comment #3 from Nick Treleaven  ---
(In reply to Steven Schveighoffer from comment #2)
> You may want to test things inside
> your unit test that have nothing to do with the example, but use the same
> code for setup, and then you have to write that code twice.

If you really want your *documented* unittest not to be runnable by a user, you
can wrap your private code in a free function with `protected` access as a
workaround.

> It's pretty easy to say // private data, for testing only.

The whole point of this issue is for when the programmer is unaware that the
documented example contains private symbols *unintentionally*. This is clearly
a significant problem otherwise @greenify wouldn't have added a custom
automated test for Phobos to check this. Copying and pasting from other tests
is a classic trigger for this.

--


[Issue 7184] parse error on *(x)++

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

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #11 from Seb  ---
PR https://github.com/dlang/dmd/pull/8218

--


[Issue 6393] allow undefined aliases as template parameters and alias tuples

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

Johannes Loher  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||johannes.lo...@fg4f.de
 Resolution|--- |WONTFIX

--- Comment #2 from Johannes Loher  ---
This would definitely need a DIP. I am in high doubt this will ever happen and
it has not seen any attention since 2011, so I am closing this for now. If you
are really interested in making this feature happen, please consider writing a
DIP for it.

--


[Issue 18830] New: Document Allowance for "new" with "scope" in @nogc Functions

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

  Issue ID: 18830
   Summary: Document Allowance for "new" with "scope" in @nogc
Functions
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: minor
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: mad...@gmail.com

For the description for @nogc functions as found here:
https://dlang.org/spec/function.html#nogc-functions

It is not indicated that "new" declarations may be compatible with "@nogc"
functions provided that they are only used for "scope" variables.  The
following program compiles on the dlang.org website:

```
class Bob {
int a;
}

void doThing() @nogc {
scope auto b = new Bob();
}

void main() {
doThing();
}
```

--


[Issue 6318] module isn't fully processed under weird conditions

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

Johannes Loher  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||johannes.lo...@fg4f.de
 Resolution|--- |FIXED

--- Comment #4 from Johannes Loher  ---
I don't know when this has been fixed, but with 2.080.0, I get both error
messages in all cases:

dmd -c -I.. Bar.d Handle.d
Bar.d(13): Error: undefined identifier Msg
foo
../basic/Messages.d(11): Error: template instance `flattenNamedEnum!Severity`
template flattenNamedEnum is not defined
../basic/Messages.d(11):while evaluating pragma(msg,
flattenNamedEnum!Severity)
bar

dmd -c -I.. Bar.d Handle.d Messages.d
Bar.d(13): Error: undefined identifier Msg
foo
Messages.d(11): Error: template instance `flattenNamedEnum!Severity` template
flattenNamedEnum is not defined
Messages.d(11):while evaluating pragma(msg, flattenNamedEnum!Severity)
bar

dmd -c -I.. Bar.d Messages.d Handle.d
Bar.d(13): Error: undefined identifier Msg
foo
Messages.d(11): Error: template instance `flattenNamedEnum!Severity` template
flattenNamedEnum is not defined
Messages.d(11):while evaluating pragma(msg, flattenNamedEnum!Severity)
bar

dmd -c -I.. Handle.d Bar.d
foo
../basic/Messages.d(11): Error: template instance `flattenNamedEnum!Severity`
template flattenNamedEnum is not defined
../basic/Messages.d(11):while evaluating pragma(msg,
flattenNamedEnum!Severity)
bar
Bar.d(13): Error: undefined identifier Msg

dmd -c -I.. Bar.d Messages.d Handle.d
Bar.d(13): Error: undefined identifier Msg
foo
Messages.d(11): Error: template instance `flattenNamedEnum!Severity` template
flattenNamedEnum is not defined
Messages.d(11):while evaluating pragma(msg, flattenNamedEnum!Severity)
bar


As this seems to work correctly, I'm closing this.

--


[Issue 18829] New: pragma msg of int incoherent

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

  Issue ID: 18829
   Summary: pragma msg of int incoherent
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ol...@fg4f.de

When working with pragma(msg,...) in relation to
https://issues.dlang.org/show_bug.cgi?id=7947 I stumbled upon the following
behaviour:

pragma(msg, typeof(int.init)); // Works: int
pragma(msg, int); // Fails:
// Error: found `)` when expecting `.` following int
// Error: found `;` when expecting identifier following `int`.
// ...

// but, obviously:
static assert(is(typeof(int.init) == int));

This seems to be related to `int` being a keyword, as everything works when
using an arbitrary struct.

--


[Issue 5931] keyword new won't allow default initialization of a struct where it has a non-zero argument constructor

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

Johannes Loher  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||johannes.lo...@fg4f.de
 Resolution|--- |WONTFIX

--- Comment #6 from Johannes Loher  ---
The first problem mentioned has been solved since 2.063.

The second problem is still present, error message of 2.080.0:

main.d(16): Error: none of the overloads of this are callable using argument
types (File), candidates are:
/usr/include/dlang/dmd/std/stdio.d(387):   
std.stdio.File.this(shared(_IO_FILE)* handle, string name, uint refs = 1u, bool
isPopened = false)
/usr/include/dlang/dmd/std/stdio.d(425):std.stdio.File.this(string
name, const(char[]) stdioOpenmode = "rb")
/usr/include/dlang/dmd/std/stdio.d(443):std.stdio.File.__ctor(R1,
R2)(R1 name) if (isInputRange!R1 && isSomeChar!(ElementEncodingType!R1))
/usr/include/dlang/dmd/std/stdio.d(451):std.stdio.File.__ctor(R1,
R2)(R1 name, R2 mode) if (isInputRange!R1 &&
isSomeChar!(ElementEncodingType!R1) && isInputRange!R2 &&
isSomeChar!(ElementEncodingType!R2))

The reason is in general, that you can't call postblits as if they were
constructors (`File file; auto f = File(file);` also does not work).

However, it seems that postblits will probably be replaced by some form of copy
constructor, so this might even resolve this issue. I will close this for now.
If you really want this feature, please submit a new issue as an enhancement
request.

--


[Issue 8256] mixin() doesn't work in a template declaration

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

Oliver Rümpelein  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||ol...@fg4f.de
 Resolution|--- |WONTFIX

--- Comment #5 from Oliver Rümpelein  ---
I consider this solved.

Please reopen if there is any implicit, actual request associated with this.

--


[Issue 8363] Empty array literal does not implicitly convert to associative array

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

Oliver Rümpelein  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||ol...@fg4f.de
 Resolution|--- |WONTFIX

--- Comment #6 from Oliver Rümpelein  ---
Starting with 2.071, you can use "aa.clear()" to achieve the desired behaviour.

If you are still in the need for the proposed syntax, please reopen this issue
or write a DIP (as this would modify the behaviour of the language).

--


[Issue 15732] std.function partial does not work with function / delegate references

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

Marco de Wild  changed:

   What|Removed |Added

 CC||nanaya...@gmail.com
   Assignee|nob...@puremagic.com|nanaya...@gmail.com

--


[Issue 5034] Ranged (or bounded) array initializer

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

Johannes Loher  changed:

   What|Removed |Added

 CC||johannes.lo...@fg4f.de

--- Comment #2 from Johannes Loher  ---
I believe this would definitely need a DIP.

--


[Issue 5014] is(T U == super) returns non-shared parent types for shared(T)

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

Johannes Loher  changed:

   What|Removed |Added

 CC||johannes.lo...@fg4f.de

--- Comment #1 from Johannes Loher  ---
Still happening in 2.080.0. The spec states that U should be a TypeSeq of base
classes and interfaces of T.

What is the desired behaviour?

This also happens for other attributes like const, immutable, and inout.

std.traits.BaseTypeTuple has the same behaviour.

--


[Issue 8063] Purity of assert's second parameter

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

Oliver Rümpelein  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||ol...@fg4f.de
 Resolution|--- |FIXED

--- Comment #2 from Oliver Rümpelein  ---
The output starting from 2.0.64 includes only the "Bad type size: 8"-message.
Resolving.

--


[Issue 4111] Foreach ranges accept floating-point extrema

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

Johannes Loher  changed:

   What|Removed |Added

   Keywords|accepts-invalid |
 CC||johannes.lo...@fg4f.de
   Severity|normal  |enhancement

--- Comment #2 from Johannes Loher  ---
This still works as of 2.080.0 and the spec indeed does not state that only
integral extrema are allowed. This is legal code at the moment. I'll tag this
as enhancement.

--


[Issue 12639] Struct-scoped import breaks UFCS

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

Johannes Loher  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||johannes.lo...@fg4f.de
 Resolution|--- |FIXED

--- Comment #2 from Johannes Loher  ---
I tested this on diefferent compiler versions. It seems to work correctly since
2.071.2.

--