[Issue 19779] New: `assert`ions evaluate in CTFE do not print `char[]` arrays as strings

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19779

  Issue ID: 19779
   Summary: `assert`ions evaluate in CTFE do not print `char[]`
arrays as strings
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: slavo5...@yahoo.com

Example:

int test(int x)
{
const char[3] msg = ['a', 'b', 'c'];

assert(false, msg);

return x;
}

void main()
{
// This statement incorrectly displays
// Error: ['a', 'b', 'c'][0..3]
enum x = test(1);

// At runtime, however, it correctly displays
// core.exception.AssertError@ladder.d(5): abc
auto y = test(1);
}


I expect `enum x test(1)` to display "abc" instead of "['a', 'b', 'c'][0..3]"

--


[Issue 19779] `assert`ions evaluated in CTFE do not print `char[]` arrays as strings

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19779

Mike Franklin  changed:

   What|Removed |Added

Summary|`assert`ions evaluate in|`assert`ions evaluated in
   |CTFE do not print `char[]`  |CTFE do not print `char[]`
   |arrays as strings   |arrays as strings

--


[Issue 18818] VariantN has unittests that are compiled into user modules

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18818

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #2 from Dlang Bot  ---
@Kriyszig created dlang/phobos pull request #6942 "variant.d: Gated unittests
behind version(StdDdoc)" fixing this issue:

- variant.d: Gated unittests behind version(StdDdoc)

  Prevents compilation of unittests into user modules
  fix Issue 18818 - unittests are compiled into user modules

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

--


[Issue 19776] [internals] Support i18n in error messages

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19776

--- Comment #2 from Iain Buclaw  ---
For future reference, keyword flags used to extract strings from dmd front-end.

--keyword=
--keyword=_
--keyword=error
--flag=error:2:c-format
--keyword=errorSupplemental
--flag=errorSupplemental:2:c-format
--keyword=warning
--flag=warning:2:c-format
--keyword=warningSupplemental
--flag=warningSupplemental:2:c-format
--keyword=deprecation
--flag=deprecation:2:c-format
--keyword=deprecationSupplemental
--flag=deprecationSupplemental:2:c-format
--keyword=message
--keyword=verror
--flag=verror:2:c-format
--keyword=verrorSupplemental
--flag=verrorSupplemental:2:c-format
--keyword=vwarning
--flag=vwarning:2:c-format
--keyword=vwarningSupplemental
--flag=vwarningSupplemental:2:c-format
--keyword=vdeprecation
--flag=vdeprecation:2:c-format
--keyword=vdeprecationSupplemental
--flag=vdeprecationSupplemental:2:c-format
--keyword=vmessage

--


[Issue 19776] [internals] Support i18n in error messages

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19776

Iain Buclaw  changed:

   What|Removed |Added

 CC||ibuc...@gdcproject.org

--- Comment #1 from Iain Buclaw  ---
As well as making sure the format string of errors are translation-friendly,
there's also a couple of functions - verror and vdeprecation - that have
optional parameters. Incidentally, they are only ever set as `kind()` and
`toPrettyChars()`.

The former kind() function returns a string literal, such as declaration
(déclaration), template (patron), function (fonction), etc...

However these will never be translated unless the function kind() returns
calling gettext().

A bare minimal example being:

> // module dmd.errors;
> nothrow @nogc
> {
> version (ENABLE_NLS)
> {
> extern (C) const(char)* gettext(scope const char* msgid);
> }
> else
> {
> const(char)* gettext(scope const char* msgid)
> {
> pragma(inline, true);
> return msgid;
> }
> }
> }
> 
> alias _ = gettext;
> 
> // module dmd.func;
> extern (C++) class FuncDeclaration : Declaration
> {
> override const(char)* kind() const
> {
> return generated ? _("generated function") : _("function");
> }
> }

--


[Issue 19778] New: ICE when accessing empty array at compile time

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19778

  Issue ID: 19778
   Summary: ICE when accessing empty array at compile time
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: tim.dl...@t-online.de

The following code compiles with DMD 2.084.0, but not with DMD 2.085.0,
2.085.1-beta.1 or 2.085.0-master-0e9418f:

struct S
{
int[] data;
}
immutable X = S([]);
enum len = X.data.length;
void main()
{
}

Using DMD 2.085.0, 2.085.1-beta.1 or 2.085.0-master-0e9418f produces the
following error:
test.d(6): Error: Internal Compiler Error: null field data

--


[Issue 19775] multiple argument string mixin doesn't expand tuples

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19775

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #3 from Dlang Bot  ---
@ntrel created dlang/dmd pull request #9521 "Fix Issue 19775 - multiple
argument string mixin doesn't expand tuples" fixing this issue:

- Fix Issue 19775 - multiple argument string mixin doesn't expand tuples

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

--


[Issue 19775] multiple argument string mixin doesn't expand tuples

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19775

--- Comment #2 from Basile-z  ---
It looks good for a PR, you'll see if it works with the CI anyway.

--


[Issue 12330] array.reserve at compile time too

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12330

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #2 from Dlang Bot  ---
dlang/druntime pull request #2532 "fix issue 12330 - array.reserve at compile
time too" was merged into master:

- e3c7e49653251661370a1ba21629b2d412874ab2 by Basile Burg:
  fix issue 12330 - array.reserve at compile time too

  makes reserve() a noop at compile-time allowing to CTFE

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

--


[Issue 16160] Selective imports in aggregate types shadow methods

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16160

Basile-z  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com

--- Comment #2 from Basile-z  ---
Works with parens:

assert(f.empty());

Because the compiler can figure out that empty() is a member func, beforehand.
And @property can be dropped from the test case.

--


[Issue 19775] multiple argument string mixin doesn't expand tuples

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19775

--- Comment #1 from Nick Treleaven  ---
Started working on this, but I'm having trouble building dmd on Windows (even
with Digger):
https://github.com/ntrel/dmd/commits/mixin-tuple

--


[Issue 12364] Pure std.math.cbrt

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12364

Basile-z  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com
  Component|dmd |druntime
   Hardware|x86 |All
 OS|Windows |All

--


[Issue 12330] array.reserve at compile time too

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12330

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@Basile-z created dlang/druntime pull request #2532 "fix issue 12330 -
array.reserve at compile time too" fixing this issue:

- fix issue 12330 - array.reserve at compile time too

  makes reserve() a noop at compile-time allowing to CTFE

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

--


[Issue 10084] alias template parameter and frame pointer capture problem

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10084

Basile-z  changed:

   What|Removed |Added

   Keywords|pull|

--


[Issue 10084] alias template parameter and frame pointer capture problem

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10084

Basile-z  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com
Summary|ICE(toir.c) alias template  |alias template parameter
   |parameter   |and frame pointer capture
   ||problem

--


[Issue 10123] Can't subtract positive number from length of array of struct with disabled default construction

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10123

Basile-z  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com

--- Comment #2 from Basile-z  ---
I don't think this is a valid issue. When an array is shrink, its memory might
be copied to another location. a struct with self reference would then become
unsafe.

You cannot speculate on the implementation details of the GC allocator.

--


[Issue 19777] New: [REG2.086a] SortedRange.opSlice is wrongly `@trusted`

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19777

  Issue ID: 19777
   Summary: [REG2.086a] SortedRange.opSlice is wrongly `@trusted`
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: ag0ae...@gmail.com

The following code used to be rejected correctly (up to 2.085). It compiles
with git master (3b4ec9299). Introduced in
.


import std.range: SortedRange;

struct R
{
int[] a;

@safe
{
@property bool empty() { return a.length == 0; }
@property ref int front() { return a[0]; }
@property ref int back() { return a[$ - 1]; }
void popFront() { a = a[1 .. $]; }
void popBack() { a = a[0 .. $ - 1]; }
@property R save() { return this; }
ref int opIndex(size_t i) { return a[i]; }
size_t length() { return a.length; }
}

R opSlice(size_t x, size_t y) @system
{
import core.stdc.stdio;
printf("This is @system code.\n");
return R(a[x .. y]);
}
}

void main() @safe
{
SortedRange!R s;
auto sliced = s[0 .. 0];
/* Prints "This is @system code.". Should fail compilation. */
}


--


[Issue 10778] Can't define a std.typecons.Typedef of a significant 2D matrix

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10778

Basile-z  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||b2.t...@gmx.com
 Resolution|--- |WORKSFORME

--- Comment #1 from Basile-z  ---
This works now. What is strange is that compiling this is super slow, 2 seconds
here.

--


[Issue 19776] New: [internals] Support i18n in error messages

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19776

  Issue ID: 19776
   Summary: [internals] Support i18n in error messages
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ibuc...@gdcproject.org

Created attachment 1743
  --> https://issues.dlang.org/attachment.cgi?id=1743=edit
French translation of expressionsem.d, and others.

Attaching a partial translation that was done by the French Translation team by
accident (I forgot to update the EXCLUDES for new files).


For brevity, posting a few random examples from that file:

---
> #: d/dmd/expressionsem.c:435
> #, gcc-internal-format, gfc-internal-format
> msgid "`%s` is not defined, perhaps `import %s;` is needed?"
> msgstr "« %s » n'est pas défini, peut-être que « import %s; » est nécessaire 
> ?"
> 
> #. Because COM classes are deleted by IUnknown.Release()
> #.
> #: d/dmd/expressionsem.c:4014
> #, gcc-internal-format, gfc-internal-format
> msgid "cannot delete instance of COM interface %s"
> msgstr "impossible de supprimer l'instance de l'interface COM %s"
> 
> #: d/dmd/safe.c:75
> #, gcc-internal-format, gfc-internal-format
> msgid "field %s.%s cannot modify fields in @safe code that overlap fields 
> with other storage classes"
> msgstr "le champs %s.%s ne peut pas modifier des champs dans du code @safe 
> qui recouvre des champs avec d'autres classes de stockage"
> 
> #: d/dmd/staticcond.c:85
> #, gcc-internal-format, gfc-internal-format
> msgid "expression %s of type %s does not have a boolean value"
> msgstr "l'expression %s de type %s n'a pas une valeur booléenne"
---


This will be deleted, however I'm not opposed to this sort of work being done,
it would be great if the dmd front-end was more fit for purpose in order to
allow such work to be undertaken.


One example where i18n can be frustrated by the front-end, is by some cases
where errors are squashed into a programmatically computed message (to save a
couple of lines?)

For example, in expressionsem.d there is this piece of code:

> const(char)* s = exp.op == TOK.plusPlus ? "increment" : "decrement";
> exp.error("cannot post-%s array slice `%s`, use pre-%s instead", s, 
> exp.e1.toChars(), s);


The string "cannot post-%s ..." will be extracted for translation, but the
inserted words, "increment" and "decrement", will not.

At a minimum, these words need to be marked for translation too, however the
better option is to make it two complete messages.  While for some languages it
would work to compose the sentence in the same way as the original format, it
would be safe to assume that languages further removed from English would have
more trouble.

--


[Issue 19775] multiple argument string mixin doesn't expand tuples

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19775

Nick Treleaven  changed:

   What|Removed |Added

 CC||n...@geany.org
  Component|druntime|dmd

--


[Issue 10785] Interface diamond covariance causes silent breakage

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10785
Issue 10785 depends on issue 10806, which changed state.

Issue 10806 Summary: Interface covariance for more than one interface at once 
also broken
https://issues.dlang.org/show_bug.cgi?id=10806

   What|Removed |Added

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

--


[Issue 10806] Interface covariance for more than one interface at once also broken

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10806

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #6 from Dlang Bot  ---
dlang/dmd pull request #9515 "Fix issue 10806: check every interface for
covariance, not just the first" was merged into master:

- 175de6781a1b199c318b25db5494619ada84102c by Mathis Beer:
  Fix issue 10806: check every interface for covariance, not just the first

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

--


[Issue 19442] multiple argument string mixin dont support char literals

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19442

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #4 from Dlang Bot  ---
dlang/dmd pull request #9491 "fix issue 19442 - multiple argument string mixin
dont support char literals" was merged into master:

- 6ec4724c9da3cbefe16a2bc462fbbfd0309caff5 by Basile Burg:
  fix issue 19442 - multiple argument string mixin dont support char literals

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

--


[Issue 19442] multiple argument string mixin dont support char literals

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19442

--- Comment #3 from Basile-z  ---
Second bug is now there https://issues.dlang.org/show_bug.cgi?id=19775

--


[Issue 19775] multiple argument string mixin doesn't expand tuples

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19775

Basile-z  changed:

   What|Removed |Added

   Keywords||rejects-valid

--


[Issue 19775] New: multiple argument string mixin doesn't expand tuples

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19775

  Issue ID: 19775
   Summary: multiple argument string mixin doesn't expand tuples
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: b2.t...@gmx.com

Splitted from 19442

passing a template parameter list does not expand the arguments:

enum x1 = 1;
enum makeIdent(args...) = mixin(args);
pragma(msg, makeIdent!("x", 1)); // Error: undefined identifier `tuple`

// Using this works but only for two arguments
enum makeIdent(args...) = mixin(args[0], args[1]);
pragma(msg, makeIdent!("x", 1)); // Output: 1

Here's the real code I was working on (like compile-time std.conv.text but
probably more efficient):

enum ctText(args...) = mixin("`", args, "`");
pragma(msg, ctText!(5, " bottles")); // Output: tuple(5, " bottles")

Above, args is not implicitly expanded.

// This works but only for two arguments
enum ctText(args...) = mixin("`", args[0], args[1], "`");
static assert(ctText!(5, " bottles") == "5 bottles");

--


[Issue 19116] dmd compiles binary but segfaults immediately when run on Ubuntu / Debian 32Bit architectures

2019-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19116

Suleyman Sahmi (سليمان السهمي)  changed:

   What|Removed |Added

 CC||sahmi.soulaim...@gmail.com

--- Comment #6 from Suleyman Sahmi (سليمان السهمي)  
---
isn't this the PIE bug?
try this:
---
$ cat >hello.d <