[Issue 10326] Disallow 'invariant' for immutable, allow class/struct invariants without (), and later disallow usage of ()

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10326

--- Comment #6 from bearophile_h...@eml.cc ---
I'd like to reopen this issue because it's not done yet. The last missing step
is to (in future) give an error in line 2 of program, disallowing the () after
invariant:


struct Foo {
invariant() {
assert(false);
}
void bar() {}
}
unittest() {} // Not allowed.
void main() {
Foo f;
f.bar;
}

--


[Issue 12736] New: @nogc std.algorithm.all

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12736

  Issue ID: 12736
   Summary: @nogc std.algorithm.all
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: Phobos
  Assignee: nob...@puremagic.com
  Reporter: bearophile_h...@eml.cc

void main() @nogc {
import std.ascii: isDigit;
import std.algorithm: all;
auto b = 12.all!isDigit;
}


DMD 2.066alpha gives:

temp.d(4,18): Error: @nogc function 'D main' cannot call non-@nogc function
'std.algorithm.all!(isDigit).all!string.all'

--


[Issue 10326] Disallow 'invariant' for immutable, allow class/struct invariants without (), and later disallow usage of ()

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10326

bearophile_h...@eml.cc changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #7 from bearophile_h...@eml.cc ---
Reopened. Waiting for opinions.

--


[Issue 10326] Disallow 'invariant' for immutable, allow class/struct invariants without (), and later disallow usage of ()

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10326

--- Comment #8 from Temtaime temta...@gmail.com ---
I agree () should give deprecation for now and error in future.

--


[Issue 12735] imports via mixin template become public imports

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12735

Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

   Keywords||accepts-invalid
 CC||andrej.mitrov...@gmail.com
   Hardware|x86 |All
 OS|Windows |All

--- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com ---
Can confirm, also in git-head.

--


[Issue 12015] std.digest.sha256 too

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12015

bearophile_h...@eml.cc changed:

   What|Removed |Added

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

--- Comment #2 from bearophile_h...@eml.cc ---
Fixed:

https://github.com/D-Programming-Language/phobos/commit/e96015dd9edb3c6ca3735b13af7c2bf82daa4ca0

--


[Issue 12719] struct.c:705: virtual void StructDeclaration::semantic(Scope*): Assertion `parent parent == sc-parent' failed.

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12719

--- Comment #4 from Kenji Hara k.hara...@gmail.com ---
(In reply to monarchdodra from comment #3)
 I still ice with this, and it passed in 2.065:
 
 //
 enum canDoIt(R) = is(typeof(Wrapper!R));
 
 struct Wrapper(R)
 {
 R r;
 static if (canDoIt!R)
 {}
 }
 
 Wrapper!int a;
 //

https://github.com/D-Programming-Language/dmd/pull/3544

--


[Issue 12691] std.regex.bmatch bug in empty OR operator inside of ()*

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12691

Dmitry Olshansky dmitry.o...@gmail.com changed:

   What|Removed |Added

   Keywords||pull
Summary|std.regex.bmatch with empty |std.regex.bmatch bug in
   |string after OR operator|empty OR operator inside of
   |crashes with free():|()*
   |invalid pointer |

--- Comment #2 from Dmitry Olshansky dmitry.o...@gmail.com ---
https://github.com/D-Programming-Language/phobos/pull/2164

The bug also applies to ctRegex as they share engines.

Reduced test-case:

import std.regex;

void main()
{

assert(bmatch(e@, ^([a-z]|)*$).empty);
assert(bmatch(e@, ctRegex!`^([a-z]|)*$`).empty);
}

--


[Issue 12737] New: static constructor requires call of super constructor

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12737

  Issue ID: 12737
   Summary: static constructor requires call of super constructor
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: rburn...@gmail.com

class A {
this(int a) {
}
}

class B : A {
static this() {
}
}

void main() {
auto n = new B();
}

fails to compile with: Error: class staticctor.B Cannot implicitly generate a
default ctor when base class staticctor.A is missing a default ctor

IMO that is wrong. A has no static ctor nor static members.

--


[Issue 12660] Wrong non-@nogc function invariant error

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12660

yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com
   Hardware|x86 |All
 OS|Windows |All

--- Comment #1 from yebblies yebbl...@gmail.com ---
I vaguely recall this being about attributes on the LHS of invariants being
ignored.

--


[Issue 12713] [REG 2.066A] std.regex.regex crashes with SEGV, illegal instruction resp. assertion failure with certain bad input

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12713

Dmitry Olshansky dmitry.o...@gmail.com changed:

   What|Removed |Added

 CC||dmitry.o...@gmail.com
Summary|std.regex.regex crashes |[REG 2.066A]
   |with SEGV, illegal  |std.regex.regex crashes
   |instruction resp. assertion |with SEGV, illegal
   |failure with certain bad|instruction resp. assertion
   |input   |failure with certain bad
   ||input
   Severity|minor   |regression

--- Comment #1 from Dmitry Olshansky dmitry.o...@gmail.com ---
Is a git-head regression introduced in :
https://github.com/DmitryOlshansky/phobos/commit/cef454d43280346c52197f785171bb400ef169ec

--


[Issue 12666] @nogc std.array.front, popFront, and more

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12666

yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com

--- Comment #2 from yebblies yebbl...@gmail.com ---
I suspect the error message is already being computed statically thanks to
constfolding, it just happens after @nogc inference has been run.

--


[Issue 12727] [REG2.066a] DMD hangs up on recursive alias declaration

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12727

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||ice, pull
Summary|GIT HEAD : DMD hangs up |[REG2.066a] DMD hangs up on
   ||recursive alias declaration

--- Comment #4 from Kenji Hara k.hara...@gmail.com ---
https://github.com/D-Programming-Language/dmd/pull/3545

--


[Issue 12713] [REG 2.066A] std.regex.regex crashes with SEGV, illegal instruction resp. assertion failure with certain bad input

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12713

Dmitry Olshansky dmitry.o...@gmail.com changed:

   What|Removed |Added

   Keywords||pull
   Assignee|nob...@puremagic.com|dmitry.o...@gmail.com

--- Comment #2 from Dmitry Olshansky dmitry.o...@gmail.com ---
https://github.com/D-Programming-Language/phobos/pull/2165

--


[Issue 12738] New: core.sys.posix.signal sigaction_t handler type mismatch

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12738

  Issue ID: 12738
   Summary: core.sys.posix.signal sigaction_t handler type
mismatch
   Product: D
   Version: D2
  Hardware: x86
OS: Linux
Status: NEW
  Severity: regression
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: hst...@quickfur.ath.cx

Code:
-
extern(C) void myHandler(int sig) {}

void main() {
import core.sys.posix.signal;
sigaction_t n;
n.sa_handler = myHandler;
}
-

Compiler output:
-
test.d(7): Error: cannot implicitly convert expression ( myHandler) of type
extern (C) void function(int sig) to extern (C) void function(int) nothrow
-

This used to work in 2.065.0.

--


[Issue 12738] core.sys.posix.signal sigaction_t handler type mismatch

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12738

--- Comment #1 from hst...@quickfur.ath.cx ---
extern(C) functions are nothrow by definition, so this code should not be
rejected.

--


[Issue 12738] core.sys.posix.signal sigaction_t handler type mismatch

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12738

hst...@quickfur.ath.cx changed:

   What|Removed |Added

  Component|DMD |druntime

--- Comment #2 from hst...@quickfur.ath.cx ---
This problem is caused by druntime commit
5a04c20ae7863cd320df4c58d801f769acf2d414 (pull request #752).

--


[Issue 12660] Wrong non-@nogc function invariant error

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12660

--- Comment #2 from bearophile_h...@eml.cc ---
(In reply to yebblies from comment #1)
 I vaguely recall this being about attributes on the LHS of invariants being
 ignored.

If I put @nogc on the right:


class Foo {
this() @nogc {}
invariant() @nogc {}
}
void main() {}


temp.d(3,17): Error: statement expected to be { }, not @
temp.d(3,23): Error: basic type expected, not {
temp.d(3,23): Error: no identifier for declarator int
temp.d(3,23): Error: Declaration expected, not '{'
temp.d(5,15): Error: } expected following member declarations in aggregate

--


[Issue 12738] core.sys.posix.signal sigaction_t handler type mismatch

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12738

Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #3 from Walter Bright bugzi...@digitalmars.com ---
(In reply to hsteoh from comment #1)
 extern(C) functions are nothrow by definition,

This would be a change to the language. Probably a good change, but a change
nevertheless, and is likely to break existing code.

--


[Issue 12660] Wrong non-@nogc function invariant error

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12660

--- Comment #3 from yebblies yebbl...@gmail.com ---
Different problem.

--


[Issue 12738] core.sys.posix.signal sigaction_t handler type mismatch

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12738

Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

 CC||andrej.mitrov...@gmail.com

--- Comment #4 from Andrej Mitrovic andrej.mitrov...@gmail.com ---
(In reply to hsteoh from comment #1)
 extern(C) functions are nothrow by definition

Since when? All extern(C) does is changes the calling convention and mangling.
You could easily have a C++ library throw exceptions in an extern(C) function,
and the same is true for D.

--


[Issue 12724] Error: return statements cannot be in contracts

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12724

--- Comment #10 from monarchdo...@gmail.com ---
(In reply to bearophile_hugs from comment #9)
 (In reply to monarchdodra from comment #8)
 
  It means you've tested what needs to be tested, and the input given need to
  proceed with the rest of the code.
 
 So the return ends just the contract. I misunderstood this, sorry.

I understand why you are against this now. Seems like a misunderstanding on
what the return would actually do.

--


[Issue 12737] static constructor requires call of super constructor

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12737

Jonathan M Davis jmdavisp...@gmx.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||jmdavisp...@gmx.com
 Resolution|--- |INVALID

--- Comment #1 from Jonathan M Davis jmdavisp...@gmx.com ---
No, this isn't a bug in the compiler, and it doesn't have anything to do with
static constructors. It's a bug in your code. This would fail to compile with
the same error:

class A {
this(int a) {
}
}

class B : A {
}

void main() {
auto n = new B();
}

The problem is that B's constructor must call A's constructor, but a
compiler-generated default constructor (which is all B is going to have,
because you didn't declare one for it) can only call default constructors for
its base class, and A doesn't have one. It has a constructor which takes an
int. So, you have to either add a default constructor to A or add an explicit
default constructor to B which calls A's constructor with an int of whatever
value would be appropriate.

--


[Issue 12737] static constructor requires call of super constructor

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12737

--- Comment #2 from Robert Schadek rburn...@gmail.com ---
But it is the static ctor and A has no static member!?

--


[Issue 4274] Better array of inner structs error message

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4274

--- Comment #7 from github-bugzi...@puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/b754fbe2883bd182e7a2e6e23e7cbad97bedcd64
Update container.d

BUG4274 already squashed.

--


[Issue 12737] static constructor requires call of super constructor

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12737

--- Comment #3 from Jonathan M Davis jmdavisp...@gmx.com ---
The static constructor has nothing to do with the error. Look at my
counter-example. It's exactly the same except for the fact that it has not
static constructor. The problem is that a constructor for B must call A's
constructor, e.g.

class B : A
{
this()
{
super(42);
}
}

but you didn't declare one, and the one created by the compiler looks like

class B : A
{
this()
{
super();
}
}

but A doesn't have a default constructor, so that doesn't work, and so the
compiler gives you the error that it's giving you. It's telling you that you
need to either give A a default-constructor so that B's compiler-generated
default constructor will work, or you need to declare a default constructor for
B which calls the constructor that A does have.

static constructors have nothing to do with inheritance and will work just fine
regardless of whether a class has static members (it just won't have much to do
if the class doesn't have any static members). So, if the static constructor in
B were complaining about the lack of one in A, then yes, that would be a bug in
the compiler. But that's not what's happening. The compiler is complaining
about the fact that it can't generate a valid default constructor for B due to
the lack of a default constructor in A.

This code would compile just fine

class A {
this(int a) {
}
}

class B : A {
static this() {
}

this()
{
super(42);
}
}

void main() {
auto n = new B();
}

as would this code

class A {
this(int a) {
}

this() {
}
}

class B : A {
static this() {
}
}

void main() {
auto n = new B();
}

--


[Issue 9881] Indirect cyclic imports are not forbidden

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9881

Martin Nowak c...@dawg.eu changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #3 from Martin Nowak c...@dawg.eu ---
I don't see a feasible way to resolve this problem by restricting or ordering
the dependencies. Consider the following example which has the same underlying
problem.

cat  a.d  CODE
__gshared Object o;
CODE
cat  b.d  CODE
import a;
shared static this() { assert(o !is null); }
CODE
cat  c.d  CODE
import a;
shared static this() { o = new Object; }
CODE

dmd -main -unittest b c -run a

dmd -main -unittest c b -run a

--


[Issue 12739] New: Foreach delegate to opApply does not have infered nothrow

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12739

  Issue ID: 12739
   Summary: Foreach delegate to opApply does not have infered
nothrow
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: safety0ff.b...@gmail.com

This doesn't work:
struct S
{
nothrow:
int opApply(int delegate(ref int) nothrow dg)
{
return 0;
}
}

void main() nothrow
{
S s;
foreach (e; s)
{
}
}

But this does:

struct S
{
nothrow:
int opApply(int delegate(ref int) nothrow dg)
{
return 0;
}
}

void main() nothrow
{
S s;
s.opApply(
(ref int x) {
return 0;
}
);
}

--


[Issue 12740] New: DMD accepts invalid version syntax

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12740

  Issue ID: 12740
   Summary: DMD accepts invalid version syntax
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: briancsch...@gmail.com

From the vibe.d source:

--
version (VibeCustomMain) {}
else:
--

The language specification does not say that else: is valid, and it is not
consistent with the normal usage of else. If you try this with a normal else
block, the compiler correctly gives the error message Error: found ':' instead
of statement.

--


[Issue 12740] DMD accepts invalid version syntax

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12740

briancsch...@gmail.com changed:

   What|Removed |Added

   Keywords||accepts-invalid
 Blocks||10233

--


[Issue 10233] [Tracker] Grammar issues

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10233

briancsch...@gmail.com changed:

   What|Removed |Added

 Depends on||12740

--


[Issue 12741] New: DMD accepts functions with contracts and no body

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12741

  Issue ID: 12741
   Summary: DMD accepts functions with contracts and no body
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: briancsch...@gmail.com

DMD accepts the following:

-
interface SomeInterface
{
void doStuff(int x) in { assert (x  100); }
}
-

The grammar specification states that a body statement is required when an in
or out contract is specified.

FunctionBody:
BlockStatement
BodyStatement
InStatement BodyStatement
OutStatement BodyStatement
InStatement OutStatement BodyStatement
OutStatement InStatement BodyStatement

--


[Issue 10233] [Tracker] Grammar issues

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10233

briancsch...@gmail.com changed:

   What|Removed |Added

 Depends on||12741

--


[Issue 12741] DMD accepts functions with contracts and no body

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12741

briancsch...@gmail.com changed:

   What|Removed |Added

   Keywords||accepts-invalid, spec
 Blocks||10233

--


[Issue 12727] [REG2.066a] DMD hangs up on recursive alias declaration

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12727

--- Comment #5 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/fbd78c3db2c2c03ec098c1b433431d7f3f144ef7
fix Issue 12727 - DMD hangs up on recursive alias declaration

By the commit fd1762c33ac034ad3112e69f21421b5c75b3cc6c, now static-if
declaration does nothing in `addMembers` phase, and conditional eponymous
template instance cannot raise recursive alias declaration error in
`TemplateInstance::semantic`, because `TemplateInstance::aliasdecl` is not set
until the end of it.

By looking for circular aliasing not only in `AliasDeclaration::semantic` but
also in `AliasDeclaration::toAlias`, we can defer the detection until
appropriate timing.

https://github.com/D-Programming-Language/dmd/commit/402efb34eba5e45f20a1b05850eac3647f6e635c
Merge pull request #3545 from 9rnsr/fix12727

[REG2.066a] Issue 12727 - DMD hangs up on recursive alias declaration

--


[Issue 12727] [REG2.066a] DMD hangs up on recursive alias declaration

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12727

github-bugzi...@puremagic.com changed:

   What|Removed |Added

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

--


[Issue 12691] std.regex.bmatch bug in empty OR operator inside of ()*

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12691

--- Comment #3 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/520438d9ef3f80af3e6c790798cfab4158e3402f
Fix issue 12691 std.regex.bmatch bug in empty OR operator inside of ()*

Must save variables that track advancement inside of infinite loops
on per-thread basis. Apparently no amount of trickery would let us avoid it.

https://github.com/D-Programming-Language/phobos/commit/5ac0225a5b1fcde88864bc5705323cc398948b47
Merge pull request #2164 from DmitryOlshansky/issue-12691

Fix issue 12691 std.regex.bmatch bug in empty OR operator inside of ()*

--


[Issue 12691] std.regex.bmatch bug in empty OR operator inside of ()*

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12691

github-bugzi...@puremagic.com changed:

   What|Removed |Added

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

--


[Issue 12741] DMD accepts functions with contracts and no body

2014-05-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12741

j...@red.email.ne.jp changed:

   What|Removed |Added

   Keywords|accepts-invalid |
 CC||j...@red.email.ne.jp

--- Comment #1 from j...@red.email.ne.jp ---
This is as expected and is a document bug.

See:
http://dlang.org/interface.html#InterfaceContracts

--