[Issue 8234] symbols used in CTFE affect the function literal type

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8234


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #1 from Don clugd...@yahoo.com.au 2012-06-26 23:48:13 PDT ---
This is not a CTFE bug.

void foo()
{
immutable int x = 0;
auto k = *(){enum e=x;return e;};
}

bug.d(4): Error: can only * a pointer, not a 'immutable(int) delegate() pure
nothrow @safe'

Closure inference for 'is this a delegate literal' vs 'is this a function
literal' incorrectly checks enum initializers.
Similar to bug 6169.

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


[Issue 8216] CTFE should allow 'pointer is inside range' comparisons

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8216


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #3 from Don clugd...@yahoo.com.au 2012-06-27 00:01:05 PDT ---
merged into D1 in https://github.com/D-Programming-Language/dmd/commit/9071bdd5

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


[Issue 7312] const should be abstract

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7312


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #3 from Don clugd...@yahoo.com.au 2012-06-27 00:06:13 PDT ---
It is currently possible to declare 'const int' variables even though they are
identical to 'immutable int' ones. This is similar.

And consider:

const[] foo(S y) pure { ... }

With this proposal, that's OK for struct S, as long as the struct has a
pointer.
But if S has no pointers, the return value needs to be immutable.
That's just annoying.

This proposal doesn't add any value.

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


[Issue 8306] New: alias 'array' this consumes array on iteration

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8306

   Summary: alias 'array' this consumes array on iteration
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: tob...@pankrath.net


--- Comment #0 from Tobias Pankrath tob...@pankrath.net 2012-06-27 01:05:37 
PDT ---
Created an attachment (id=1121)
code showing the bug

The attached program produces buggy code. This code stores an index
(a list of Agg*) to some Agg and prints all Agg currently in this
index. Then it prints every Agg in turn.

In the foreach loop every agg is empty. Which is wrong. It works however, if
I comment out the alias content this; line or if I don't print the index
before the loop.

struct A
{
int a;
int b;
}

struct Agg
{
A[] content;
alias content this;
}

void main(string[] args)
{
Agg* agg = new Agg;
A l1 = A((1), (2));
A l2 = A((2), (3));
A l3 = A((3), (4));
agg.content ~= [l1, l2, l3];

Agg*[] aggIndex = [agg];
writefln(these are the %s aggregates:\n%s,
aggIndex.length,
aggIndex);
foreach(Agg* myAgg; aggIndex)
{
A[] as = (*myAgg).content;
writefln(current agg %s with length %s, as, as.length);
}
}

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


[Issue 8306] alias 'array' this consumes array on iteration

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8306


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

   What|Removed |Added

 CC||jmdavisp...@gmx.com


--- Comment #1 from Jonathan M Davis jmdavisp...@gmx.com 2012-06-27 01:29:29 
PDT ---
On the latest master, I get the exact same behavior regardless of whether the
alias is there. I always get

these are the 1 aggregates:
[7F3AB1ECEFF0]
current agg [A(1, 2), A(2, 3), A(3, 4)] with length 3

and commenting out the first print statement has no effect on the second.

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


[Issue 7312] const should be abstract

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7312


timon.g...@gmx.ch changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||WONTFIX


--- Comment #4 from timon.g...@gmx.ch 2012-06-27 04:40:06 PDT ---
agreed.

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


[Issue 8307] New: inconsistent treatment of auto functions

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8307

   Summary: inconsistent treatment of auto functions
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2012-06-27 04:56:58 PDT ---
function.html states:
Auto Functions

Auto functions have their return type inferred from any ReturnStatements in the
function body.

An auto function is declared without a return type. If it does not already have
a storage class, use the auto storage class.

If there are multiple ReturnStatements, the types of them must match exactly.
If there are no ReturnStatements, the return type is inferred to be void. 

DMD sez:

auto foo(){ return 0; return 0.0; } // ok

auto bar(int x){ if(x==0) return 0; return bar(x-1)+1; } // error

The compiler, the documentation or both need to be fixed.

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


[Issue 7205] Function attribute inference fails in case of mutual dependencies

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7205


timon.g...@gmx.ch changed:

   What|Removed |Added

   Keywords||rejects-valid, spec


--- Comment #1 from timon.g...@gmx.ch 2012-06-27 05:10:28 PDT ---
Apparently the spec has been changed to document the buggy behaviour.

function.html:
Cyclic functions (i.e. functions that wind up directly or indirectly calling
themselves) are inferred as being impure, throwing, and @system.

Therefore this is now both a spec and a compiler bug.

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


[Issue 8308] New: wrong function literal type inference results in type coercion

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8308

   Summary: wrong function literal type inference results in type
coercion
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2012-06-27 05:17:17 PDT ---
DMD 2.059:
void main(){
auto x = [x=1.0, (long x)=x][0]; // should be an error?
double d = 1.0;
assert(x(0)!=*cast(long*)d); // (fails)
}

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


[Issue 8309] New: ICE in typeMerge on 'void main(){auto x = [()=1.0, ()=1]; }'

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8309

   Summary: ICE in typeMerge on 'void main(){auto x = [()=1.0,
()=1];}'
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: ice
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2012-06-27 05:19:34 PDT ---
DMD 2.059:
void main(){auto x = [()=1.0, ()=1];} // ICE

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


[Issue 8310] New: writeln of Range of fixed size array

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8310

   Summary: writeln of Range of fixed size array
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-06-27 05:21:17 PDT ---
import std.stdio: writeln;
import std.algorithm: map;
import std.array: array;
void main() {
char[2] two = ['a', 'b'];
auto pieces = [1, 2].map!(x = two)();
writeln(pieces.array());
}


It gives an acceptable output (dmd 2.060alpha):

[ab, ab]



But printing the lazy range itself fails:


import std.stdio: writeln;
import std.algorithm: map;
void main() {
char[2] two = ['a', 'b'];
auto pieces = [1, 2].map!(x = two)();
writeln(pieces);
}


...\dmd2\src\phobos\std\format.d(1978): Error: template std.format.formatValue
does not match any function template declaration
...\dmd2\src\phobos\std\format.d(1203): Error: template std.format.formatValue
cannot deduce template function from argument types
!()(LockingTextWriter,char[2u],FormatSpec!(char))
...\dmd2\src\phobos\std\format.d(2006): Error: template std.format.formatValue
does not match any function template declaration
...\dmd2\src\phobos\std\format.d(1203): Error: template std.format.formatValue
cannot deduce template function from argument types
!()(LockingTextWriter,char[2u],FormatSpec!(char))
...\dmd2\src\phobos\std\format.d(2474): Error: template instance
std.format.formatRange!(LockingTextWriter,Result,char) error instantiating
...\dmd2\src\phobos\std\format.d(2761):instantiated from here:
formatValue!(LockingTextWriter,Result,char)
...\dmd2\src\phobos\std\format.d(420):instantiated from here:
formatGeneric!(LockingTextWriter,Result,char)
...\dmd2\src\phobos\std\stdio.d(683):instantiated from here:
formattedWrite!(LockingTextWriter,char,Result)
...\dmd2\src\phobos\std\stdio.d(1594):instantiated from here:
write!(Result,char)
test.d(6):instantiated from here: writeln!(Result)
...\dmd2\src\phobos\std\format.d(2761): Error: template instance
std.format.formatValue!(LockingTextWriter,Result,char) error instantiating
...\dmd2\src\phobos\std\format.d(420):instantiated from here:
formatGeneric!(LockingTextWriter,Result,char)
...\dmd2\src\phobos\std\stdio.d(683):instantiated from here:
formattedWrite!(LockingTextWriter,char,Result)
...\dmd2\src\phobos\std\stdio.d(1594):instantiated from here:
write!(Result,char)
test.d(6):instantiated from here: writeln!(Result)
...\dmd2\src\phobos\std\format.d(420): Error: template instance
std.format.formatGeneric!(LockingTextWriter,Result,char) error instantiating
...\dmd2\src\phobos\std\stdio.d(683):instantiated from here:
formattedWrite!(LockingTextWriter,char,Result)
...\dmd2\src\phobos\std\stdio.d(1594):instantiated from here:
write!(Result,char)
test.d(6):instantiated from here: writeln!(Result)
...\dmd2\src\phobos\std\stdio.d(683): Error: template instance
std.format.formattedWrite!(LockingTextWriter,char,Result) error instantiating
...\dmd2\src\phobos\std\stdio.d(1594):instantiated from here:
write!(Result,char)
test.d(6):instantiated from here: writeln!(Result)
...\dmd2\src\phobos\std\stdio.d(1594): Error: template instance
std.stdio.File.write!(Result,char) error instantiating
test.d(6):instantiated from here: writeln!(Result)
test.d(6): Error: template instance std.stdio.writeln!(Result) error
instantiating

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


[Issue 8311] New: Incomplete doc for std.getopt.getopt function.

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8311

   Summary: Incomplete doc for std.getopt.getopt function.
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: websites
AssignedTo: nob...@puremagic.com
ReportedBy: mp8...@rambler.ru


--- Comment #0 from Michele Pes mp8...@rambler.ru 2012-06-27 07:09:18 PDT ---
It seems to throw Exception(Unrecognized option  ~ bad_opt) when an unknown
option is encountered. Docs tell about ConvException only...

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


[Issue 8312] New: Too many error messages with a writeln of fixed size array

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8312

   Summary: Too many error messages with a writeln of fixed size
array
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-06-27 09:39:16 PDT ---
This is wrong D2 code (because currently D doesn't have variable length arrays,
and n is a run-time value):


import std.stdio;
void main() {
uint n = 1;
uint[n + 1] foo;
writeln(foo);
}


I think it prints too many error messages (DMD 2.060alpha):

test.d(4): Error: variable n cannot be read at compile time
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: variable n cannot be read at compile time
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: variable n cannot be read at compile time
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: variable n cannot be read at compile time
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: variable n cannot be read at compile time
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u
test.d(4): Error: Integer constant expression expected instead of n + 1u

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


[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5570



--- Comment #29 from Iain Buclaw ibuc...@ubuntu.com 2012-06-27 10:02:08 PDT 
---
(In reply to comment #27)
 (In reply to comment #26)
  (In reply to comment #25)
   Sigh – seems like I was not exactly right about how GDC and LDC are 
   handling
   arrays. Instead of treating them like the equivalent struct, they are 
   treated
   as if length and pointer were two separate arguments […]
  They are created as a two field struct in GDC.
 
 Oh well, apparently GDC handles dynamic arrays like structs in most cases, but
 as size_t/void* pairs for variadic arguments, ABI-wise – I discovered this
 behavior looking at the generated assembly while working on the LDC vararg 
 ABI,
 and didn't expect formal arguments to be treated differently. Maybe the
 behavior should be unified?
 

Yes, that is correct for dynamic arrays. :~)

It does it on a condition that's pre-set as 'true' and can't be altered by the
user.  Of course, if all two field types in D (D arrays; delegates) should
*always* be passed in the same way as two field struct should be, then I can
turn it off (and add a switch to toggle it), or remove this code.

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


[Issue 8313] New: stack overflow on recursive ifti evaluation

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8313

   Summary: stack overflow on recursive ifti evaluation
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2012-06-27 10:14:07 PDT ---
DMD 2.059 crashes due to what appears to be a stack overflow when run on the
following code:

auto bar()(int x){return x;}
auto bar()(int x = bar()){return x;}
static assert(bar(1));

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


[Issue 7437] DMD enters infinite loop during overload resolution

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7437


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

   What|Removed |Added

   Keywords||pull


--- Comment #4 from Kenji Hara k.hara...@gmail.com 2012-06-27 19:43:20 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1028

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


[Issue 7980] Stack overflow / recursive expansion with alias this

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7980


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

   What|Removed |Added

   Keywords||ice, pull
 OS/Version|Windows |All
   Severity|normal  |major


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-06-27 19:43:54 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1028

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


[Issue 8053] Recursive alias this causes infinite loop

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8053


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

   What|Removed |Added

   Keywords||pull
   Severity|normal  |major


--- Comment #2 from Kenji Hara k.hara...@gmail.com 2012-06-27 19:44:13 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1028

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


[Issue 8310] writeln of Range of fixed size array

2012-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8310


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

   What|Removed |Added

   Keywords||pull
   Platform|x86 |All
 OS/Version|Windows |All


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-06-27 21:19:05 PDT ---
https://github.com/D-Programming-Language/phobos/pull/652

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