[Issue 9409] New: [2.062-alpha] Regression with $ inside of expression tuples

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9409

   Summary: [2.062-alpha] Regression with $ inside of expression
tuples
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dmitry.o...@gmail.com


--- Comment #0 from Dmitry Olshansky  2013-01-26 
23:56:46 PST ---
Courtesy of dustmite:

import std.typetuple;

template idxTypes(Prefix...)
{
TypeTuple!((Prefix[$-1])) idxTypes;
}

alias Types = idxTypes!(int);

Obviously this used to work.

git bisect says:

commit: cd9ef35c402dbeb177343c7cea5b9ed4a5e6b94f
Fix Issue 6408 - string[].init gives a wrong type

Allow reinterpreting a slice or index expression as a dynamic array, static
array, or associative array

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9409] [2.062-alpha] Regression with $ inside of expression tuples

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9409


Kenji Hara  changed:

   What|Removed |Added

   Keywords||pull, rejects-valid


--- Comment #1 from Kenji Hara  2013-01-27 00:46:55 PST ---
https://github.com/D-Programming-Language/dmd/pull/1562

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9409] [2.062-alpha] Regression with $ inside of expression tuples

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9409


Kenji Hara  changed:

   What|Removed |Added

   Severity|critical|regression


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9398] Wrong diagnostic for ternary operator type mismatch

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9398


Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8892] Wrong diagnostic for static array assignment

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8892



--- Comment #6 from Kenji Hara  2013-01-27 01:16:38 PST ---
(In reply to comment #4)
> What I don't understand is why the above fails at compile-time but the
> following compiles (it fails at runtime):
> 
> char[2] data = ['A'];
> 
> $ object.Error: lengths don't match for array copy, 2 = 1
> 
> I think this case should also an accepts-invalid, because the compiler can see
> at compile-time that the lengths don't match.

It is known inconsistency around static array initialization.

int[3] garr = [1,2];
// When creating data section, garr[2] is filled by 0

void main()
{
int[3] larr = [1,2];
// This is translated to runtime element-wise blit assign:
// larr[0..3] = [1,2]
// and fails at runtime.
}

When we based on the issue, following code still have similar issue.

struct Foo {
char[2] data;
}
void main() {
auto f = Foo(['A']);
// 1. should be compile time error, array length mismatch, or
// 2. the initializer should be translated to Foo(['A', char.init]) ?
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8892] Wrong diagnostic for static array assignment

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8892



--- Comment #7 from github-bugzi...@puremagic.com 2013-01-27 01:32:19 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/646ce34fae3a1e12032bb7a2343e54daf0074db0
Fixes Issue 8892 - Better diagnostic for static array assignment.

https://github.com/D-Programming-Language/dmd/commit/c316e2e6d059b7e6fdc6ae8616e72dfda9dfa8f6
Merge pull request #1558 from AndrejMitrovic/Fix8892

Issue 8892 - Better diagnostic for static array assignment

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9410] New: Wrong selection for function overload

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9410

   Summary: Wrong selection for function overload
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: rswhi...@googlemail.com


--- Comment #0 from rswhi...@googlemail.com 2013-01-27 05:11:22 PST ---
This code:

[code]
import std.stdio;

struct Vec2(T) {
public:
T x;
T y;

this(T x, T y) {

}
}

alias Vec2f = Vec2!(float);

class Foo {
public:
static Foo make(float i, ref const Vec2f a) {
return new Foo();
}

static Foo make(float i, const Vec2f a) {
return Foo.make(i, a);
}
}

void main() {
Foo f = Foo.make(42, Vec2f(4, 2));
}
[/code]

prints:

Error: (Vec2!(float) __ctmp1173 = _D4c42511__T4Vec2TfZ4Vec26__initZ;
, __ctmp1173).this(4F, 2F) is not an lvalue

But IMO it should compile.
Also this code:

[code]
import std.stdio;

struct Rect(T) {
private:
T x, y, w, h;

public:
this(T x, T y, T w, T h) {

}
}

alias FloatRect = Rect!(float);

class A { }
class B : A { }

class C {
public:
this(A a, ref const FloatRect sr) {

}

this(A a, const FloatRect sr) {
this(a, sr);
}
}

void main() {
// new C(new A(), FloatRect(0, 1, 2, 3)); // works
new C(new B(), FloatRect(0, 1, 2, 3));
}
[/code]

seems to have the same problem. It prints:

Error: (Rect!(float) __ctmp1173 = _D4c84111__T4RectTfZ4Rect6__initZ;
, __ctmp1173).this(0F, 1F, 2F, 3F) is not an lvalue

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9410] Wrong selection for function overload

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9410


Maxim Fomin  changed:

   What|Removed |Added

   Keywords||diagnostic, rejects-valid
 CC||ma...@maxim-fomin.ru


--- Comment #1 from Maxim Fomin  2013-01-27 05:35:11 PST 
---
Reduced (Error: S() is not an lvalue)

import std.stdio;

struct S {}

void foo(float f, ref const S s)
{
writeln("const");
}

void foo(float f, const S s)
{
writeln("ref const");
}

void main()
{
foo(1, S()); // 1f fixes code and calls ref const version
}


If overloaded functions have several parameters, one of which is
const-qualified used-defined type and functions differer only in refness of
that parameter, supplying implicitly convertible arguments (like int to float)
to other parameters breaks compiler. 

Passing 1f results in calling ref const version which contradicts to recent
revertion of passing struct literals by ref (however that was without const).
It is unclear what should happen in presence of const.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8892] Wrong diagnostic for static array assignment

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8892


Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #8 from Kenji Hara  2013-01-27 07:01:24 PST ---
Error message is now improved.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9410] Wrong selection for function overload

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9410



--- Comment #2 from rswhi...@googlemail.com 2013-01-27 09:31:13 PST ---
This also fails.

Error: A() is not an lvalue

[code]
import std.stdio;

struct A { }

void foo(const A a, float r) {

}

void foo(ref A a, float r) {

}

void main()
{
foo(A(), 12);
}
[/code]

_That_ is strange.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1841] Closure detection doesn't work when variable is used in a nested function

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1841



--- Comment #8 from github-bugzi...@puremagic.com 2013-01-27 11:34:12 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e5de59d30026fa5267541a928d67af1e8c06f922
Fix issue 1841 Closure detection fails in nested functions

If an escaping function doesn't use any closure variables, but
calls another nested function which does, it must be marked as
needing a closure. This 'calling a sibling' case was missing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8785] feature request: static mixin

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8785



--- Comment #2 from luka8088  2013-01-27 12:21:19 PST ---
(In reply to comment #1)
> What this would basically do is introduce namespaces into the language, as 
> 't1'
> would be some kind of pseudo-type which has access to its parent, but it 
> itself
> wouldn't be a template (since it doesn't require !()), and it wouldn't be an
> aggregate.
> 
> Not that there's anything wrong with that. :)
> 
> Anyway for the longest time I actually thought "mixin myTemplate t1" means the
> symbols are only accessible through "t1", but the spec does say it's only used
> for disambiguating so I was wrong.

I also thought this way, until I read the docs properly. It would be useful in
some cases to have both behaviors. "static" is proposed because it is already
used with imports in this way - "import" vs "static import". Maybe "static" is
not the best keyword/solution for this case but it is the first solution that
came to mind.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1841] Closure detection doesn't work when variable is used in a nested function

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1841


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9409] [2.062-alpha] Regression with $ inside of expression tuples

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9409



--- Comment #2 from github-bugzi...@puremagic.com 2013-01-27 13:06:36 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/679a359204b9b55741f04111f82f9e51ed6b7a48
fix Issue 9409 - [2.062-alpha] Regression with $ inside of expression tuples

https://github.com/D-Programming-Language/dmd/commit/6b6230fa91b23d077e29ee8b28dc04edc2d5f08d
Merge pull request #1562 from 9rnsr/fix9409

Issue 9409 - [2.062-alpha] Regression with $ inside of expression tuples

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9409] [2.062-alpha] Regression with $ inside of expression tuples

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9409


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9411] New: Assigning to delegate, assertion failure on line 1702 in file 'cast.c'

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9411

   Summary: Assigning to delegate, assertion failure on line 1702
in file 'cast.c'
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: callumena...@gmail.com


--- Comment #0 from callumena...@gmail.com 2013-01-27 19:12:38 PST ---
Compiling with 2.061 release. 

void main()
{
int z;
typeof((int a){return z;}) dg;
dg = cast(typeof((int a){return z;})) (int a){return z;};
}

Assertion failure: 'e->type->nextOf()->covariant(t->nextOf()) == 1' on line
1702 in file 'cast.c'

If dg is made a function by removing reference to z, it compiles.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9412] New: Invariants allowed to call public functions indirectly

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9412

   Summary: Invariants allowed to call public functions indirectly
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: accepts-invalid, spec
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: kekeni...@yahoo.co.jp
Blocks: 520


--- Comment #0 from kekeni...@yahoo.co.jp 2013-01-27 21:34:53 PST ---
Invariants are not allowed to call public functions _directly_.(Issue 520)
However, they can do indirectly, and that makes an infinite loop.

Code:
//import std.stdio; // for trace log
class Inv {
invariant() {
//writeln("invariant");
prv();
//pub(); // not allowed
}
private void prv() const {
//writeln("private");
pub();
}
void pub() const {
//writeln("public");
}
}
void main() {
auto test = new Inv();
test.pub();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9412] Invariants allowed to call public functions indirectly

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9412


Maxim Fomin  changed:

   What|Removed |Added

 CC||ma...@maxim-fomin.ru


--- Comment #1 from Maxim Fomin  2013-01-27 22:22:16 PST 
---
>From http://dlang.org/dbc.html:

"The code in the invariant may not call any public non-static members of the
class or struct, either directly or indirectly. Doing so will result in a stack
overflow, as the invariant will wind up being called in an infinitely recursive
manner. "

I understand that it does not mean that implementation enforces the rules.
Ability to call functions from invariants is a loophole, and there is
possibility to enter infinite loop in cases which are more complicated then
above. Human still can write code which avoids compiler constraints - the
question here is whether to introduce control flow for calling functions from
invariants, or throw exceptions, or just do nothing.

Either this should be marked as enhancement request, or RESOLVED-WONTFIX

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9385] [Regression 2.057] null literal should be implicitly convertible to bool

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9385


Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9413] New: Incorrect modification inside contracts is not detected correctly

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9413

   Summary: Incorrect modification inside contracts is not
detected correctly
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: accepts-invalid, diagnostic
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara  2013-01-27 23:46:20 PST ---
L7 and L17 should cause errors, but doesn't.

int foo(int x)
in
{
int a;
int bar(int y)
{
x = 10; // L7
return 2;
}
x = 10; // L10 err, OK
}
out(r)
{
int a;
int baz(int y)
{
x = 10; // L17
return 2;
}
x = 10; // L20
}
body
{
return 1;
}

output:
test.d(10): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(10): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(20): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(20): Error: variable test.foo.x cannot modify parameter 'x' in contract

And, there is also duplicated error message issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 9414] New: Incorrect modification inside contracts is not detected on virtual function

2013-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9414

   Summary: Incorrect modification inside contracts is not
detected on virtual function
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: accepts-invalid, wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara  2013-01-27 23:50:06 PST ---
This code should be compile error, but doesn't.

class C
{
int foo(int x)  // or 'final'
in
{
x = 10; // L6
}
out(r)
{
x = 10; // L10
}
body
{
return 1;
}
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---