[Issue 3854] Error on static initialization of arrays with trailing comma.

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3854



--- Comment #7 from Iain Buclaw ibuc...@ubuntu.com 2010-04-02 04:27:27 PDT ---
(In reply to comment #6)
 (In reply to comment #5)
  
  Attached is a patch that resolves the issue. Am not sure that the patch in 
  the
  other bug report is reasonably correct, but hey ho!
  
  Regards
  Iain
 
 Eh? What makes you think it isn't?

Well, from what I can tell, if I were to have the following code excerpt:

int[] a = [1]];

The scan ahead routine will swallow the [1], and since (--brackets == 0),
takes a peek at the last bracket, to which it matches in the if statement and
says 'yep, that is OK'.
In other words, it assumes that whether or not the above line is correct has
already been checked, or will be checked later on during the compile (which I
don't doubt it already has, but at least see it better to have some sort of
sanitisation when checking things).

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


[Issue 3854] Error on static initialization of arrays with trailing comma.

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3854



--- Comment #8 from Ellery Newcomer ellery-newco...@utulsa.edu 2010-04-02 
09:50:23 PDT ---
(In reply to comment #7)
  
  Eh? What makes you think it isn't?
 
 Well, from what I can tell, if I were to have the following code excerpt:
 
 int[] a = [1]];
 
 The scan ahead routine will swallow the [1], and since (--brackets == 0),
 takes a peek at the last bracket, to which it matches in the if statement and
 says 'yep, that is OK'.
 In other words, it assumes that whether or not the above line is correct has
 already been checked, or will be checked later on during the compile (which I
 don't doubt it already has, but at least see it better to have some sort of
 sanitisation when checking things).

The scan ahead doesn't swallow anything. It does see only [1] and because
(--brackets == 0) it says I'm going to parse this as ArrayInitializer, which
it does. The next loop (the ArrayInitializer rule) swallows [1], and no more.
Then parseInitializer is done. The function that called parseInitializer
(parseDeclarations or whatever), will expect a semicolon or comma to be the
next token, and when it sees lbracket, it errors.

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


[Issue 4042] New: Unable to instantiate a struct template.

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4042

   Summary: Unable to instantiate a struct template.
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: blocker
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: e.insafutdi...@gmail.com


--- Comment #0 from Eldar Insafutdinov e.insafutdi...@gmail.com 2010-04-02 
10:25:58 PDT ---
Created an attachment (id=598)
testcase

When compiling the attached code I get

main.d(51): Error: this for ref_ needs to be type QList not type
QList!(QGraphicsWidget)
main.d(51): Error: struct main.QList!(QGraphicsWidget).QList member ref_ is not
accessible

This bug caused a lot of headache and held off development of QtD for quite a
while. I was finally able to reduce it to the sensible sized
test-case(originally the number of source files was about 500). If you play
with the testcase you'll find out that even slight modifications will lead to
change of the error message or to disappearing of it. Something is going
horribly wrong in the compiler. The version I tested it with is 2.042 which is
not present on the list.

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


[Issue 4043] New: Class is forward referenced when looking for sizeof

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4043

   Summary: Class is forward referenced when looking for sizeof
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: e.insafutdi...@gmail.com


--- Comment #0 from Eldar Insafutdinov e.insafutdi...@gmail.com 2010-04-02 
10:42:37 PDT ---
main.d(41): Error: class main.QGraphicsWidget is forward referenced when
looking for 'sizeof'
main.d(14): Error: template instance main.QTypeInfo!(QGraphicsWidget) error
instantiating
main.d(49):instantiated from here: QList!(QGraphicsWidget)

It is based on the a modified testcase from
http://d.puremagic.com/issues/show_bug.cgi?id=4042 and may actually be the same
issue. But since it shows quite a different error message, I am putting it as a
separate report.

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


[Issue 4043] Class is forward referenced when looking for sizeof

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4043



--- Comment #1 from Eldar Insafutdinov e.insafutdi...@gmail.com 2010-04-02 
10:43:05 PDT ---
Created an attachment (id=599)
testcase

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


[Issue 4044] New: [Tracker] Bad debug information and DWARF errors

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4044

   Summary: [Tracker] Bad debug information and DWARF errors
   Product: D
   Version: 1.055
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: rob...@octarineparrot.com


--- Comment #0 from Robert Clipsham rob...@octarineparrot.com 2010-04-02 
21:45:09 BST ---
This tracker bug is intended to keep track of all issues that cause
difficulties with debugging D. These include invalid DWARF output, errors from
gdb or other debuggers that appear to be caused by bad debugging information,
as well as any other issues that make debugging D applications difficult or
even impossible.

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


[Issue 4045] New: [CTFE] increasing array length

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4045

   Summary: [CTFE] increasing array length
   Product: D
   Version: future
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-04-02 14:21:48 PDT ---
(Not tested with the latest bug fixes, so this can be already fixed)


int foo() {
int[] a;
a.length = 1;
return 0;
}
enum int _ = foo();
void main() {}


dmd 2.042 gives:

test.d(3): Error: (a.length) = 1u cannot be evaluated at compile time

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


[Issue 4046] New: [CTFE] std.intrinsic

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4046

   Summary: [CTFE] std.intrinsic
   Product: D
   Version: future
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-04-02 14:25:39 PDT ---
import std.intrinsic: bt;
int foo() {
uint x = uint.max;
return bt(x, 5);
}
int _ = foo();
void main() {}


dmd 2.042 gives:

test.d(4): Error: cannot evaluate bt(( x),5u) at compile time
test.d(6): Error: cannot evaluate foo() at compile time
test.d(6): Error: cannot evaluate foo() at compile time


In CTFE the the compiler can replace the intrinsics with little functions with
the same semantics.

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


[Issue 4047] New: [CTFE] class/struct heap allocation

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4047

   Summary: [CTFE] class/struct heap allocation
   Product: D
   Version: future
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-04-02 14:31:22 PDT ---
struct Foo {}
class Bar {}
int spam() {
Foo* f = new Foo();
Bar b = new Bar();
return 0;
}
enum int _ = spam();
void main() {}


dmd 2.042 gives:

test.d(4): Error: Cannot interpret new Foo at compile time
test.d(8): Error: cannot evaluate spam() at compile time
test.d(8): Error: cannot evaluate spam() at compile time

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


[Issue 4048] New: [CTFE] struct initializer

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4048

   Summary: [CTFE] struct initializer
   Product: D
   Version: future
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-04-02 14:34:02 PDT ---
(Not tested with the latest bug fixes)


struct Foo {
/*static*/ struct Bar { int x; }
Bar b = { x: 1 };
}
int spam() {
Foo f;
return 0;
}
void main() {
enum int _ = spam();
}


dmd 2.042 gives (with no line of error):

Error: cannot make expression out of initializer for b

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


[Issue 4049] New: enum constant with no initializer

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4049

   Summary: enum constant with no initializer
   Product: D
   Version: future
  Platform: All
OS/Version: All
Status: NEW
  Keywords: rejects-valid
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-04-02 14:37:38 PDT ---
This program correctly gives an error message, but I don't see why this code is
wrong, here f can be just f.init:


struct Foo {}
enum Foo f;
void main() {}


dmd 2.042 gives:

test.d(2): Error: variable test.f manifest constants must have initializers

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


[Issue 3387] gdb: symbols in the backtrace are not demangled

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3387


Robert Clipsham rob...@octarineparrot.com changed:

   What|Removed |Added

   Keywords|wrong-code  |
 Status|NEW |RESOLVED
 CC||rob...@octarineparrot.com
 Resolution||INVALID


--- Comment #3 from Robert Clipsham rob...@octarineparrot.com 2010-04-02 
22:46:37 BST ---
I've removed the wrong-code keyword, and closing this bug, as it isn't a dmd
issue. The code generated is correct, as -gc means D should pretend to be C...
Which means symbol names have to be mangled, as otherwise they are not valid C
symbols. It also means gdb won't demangle them, as it detects C and not D. The
correct solution for this bug is to add support for the D extensions to gdb,
there's nothing dmd can do about this without adding another debugging mode,
something I think is best avoided.

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


[Issue 4050] New: [CTFE] array struct member slice update

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4050

   Summary: [CTFE] array struct member slice update
   Product: D
   Version: future
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-04-02 14:47:06 PDT ---
(Not tested with the latest bug fixes, so this can be already fixed)


struct Foo {
int[1] data;
}
int bar() {
Foo f;
f.data = [1];
return 0;
}
enum int _ = bar();
void main() {}


dmd 2.042 gives:

test.d(6): Error: Slice operation f.data[] = [1] cannot be evaluated at compile
time
test.d(9): Error: cannot evaluate bar() at compile time
test.d(9): Error: cannot evaluate bar() at compile time

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


[Issue 4052] New: [CTFE] increment from array item

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4052

   Summary: [CTFE] increment from array item
   Product: D
   Version: future
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-04-02 14:49:25 PDT ---
(Not tested with the latest bug fixes, so this can be already fixed)


int foo() {
int[] arr = new int[1];
int s;
foreach (x; arr)
s += x;
foreach (x; arr)
s += x * x;
return 0;
}
enum int _ = foo();
void main() {}


dmd 2.042 gives:

Error: Integer constant expression expected instead of null
test.d(10): Error: cannot evaluate foo() at compile time
test.d(10): Error: cannot evaluate foo() at compile time

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


[Issue 4053] New: To avoid struct ctor/opCall conflicts

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4053

   Summary: To avoid struct ctor/opCall conflicts
   Product: D
   Version: future
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-04-02 17:03:42 PDT ---
This is a D2 program:


struct Foo {
this(int x=0) {}
static void opCall(int x, int y) {}
}
void main() {
auto f2 = Foo(1);// line 6, OK
auto f3 = Foo(1, 2); // line 7, Err, opCall not found
auto f1 = Foo(); // line 8, Err, conflicts with opCall again
}


dmd 2.042 gives:

test.d(7): Error: constructor test.Foo.this (int x = 0) is not callable using
argument types (int,int)
test.d(7): Error: expected 1 arguments, not 2 for non-variadic function type
ref Foo(int x = 0)
test.d(8): Error: function test.Foo.opCall (int x, int y) is not callable using
argument types ()
test.d(8): Error: expected 2 function arguments, not 0
test.d(8): Error: variable test.main.f1 voids have no value
test.d(8): Error: expression opCall() is void and has no value


My suggestion is in structs to disallow opCall() if a this() is present.
This makes the program more tidy, and avoids that conflict with opCall when
Foo() is used with no arguments.

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


[Issue 4055] New: ICE(tocsym.c:407) virtual Symbol* FuncDeclaration::toSymbol(): Assertion `0' failed.

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4055

   Summary: ICE(tocsym.c:407) virtual Symbol*
FuncDeclaration::toSymbol(): Assertion `0' failed.
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: rob...@octarineparrot.com


--- Comment #0 from Robert Clipsham rob...@octarineparrot.com 2010-04-03 
04:45:34 BST ---
Test case:
a.d:

import b;
class Sub : Super
{
int fail()
{
return Super.fail();
}

}

b.d:

class Super
{
int fail()
out (result) {}
body
{
assert(0);
}
}

Compile with dmd -c a.d. If you compile with dmd a.d b.d the ICE does not
occur. DMD outputs:
b.d(5): Error: function __ensure forward declaration
linkage = 0
dmd: tocsym.c:407: virtual Symbol* FuncDeclaration::toSymbol(): Assertion `0'
failed.

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


[Issue 4055] ICE(tocsym.c:407) virtual Symbol* FuncDeclaration::toSymbol(): Assertion `0' failed.

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4055



--- Comment #1 from Robert Clipsham rob...@octarineparrot.com 2010-04-03 
04:48:57 BST ---
I should note this is blocking a linux port of ddmd.

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


[Issue 4054] ICE(eh.c) line 49

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4054



--- Comment #1 from Robert Clipsham rob...@octarineparrot.com 2010-04-03 
04:49:17 BST ---
I should note that this is blocking a linux port of ddmd.

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


[Issue 4056] New: Template instantiation with bare parameter not documented

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4056

   Summary: Template instantiation with bare parameter not
documented
   Product: D
   Version: 2.041
  Platform: All
   URL: http://digitalmars.com/d/2.0/template.html
OS/Version: All
Status: NEW
  Keywords: spec
  Severity: normal
  Priority: P2
 Component: www.digitalmars.com
AssignedTo: nob...@puremagic.com
ReportedBy: jlqu...@optonline.net


--- Comment #0 from Jerry Quinn jlqu...@optonline.net 2010-04-02 21:24:02 PDT 
---
I've recently seen people using template instances like:

mytemplate!int var;

The docs don't say anything about this form, nor do the release notes for that
matter.  Either it's a bug (I assume not) or the spec needs to document it.

I assume this form is only good for single template parameters.  Are there
other limits on what parameters can be used in this way?

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


[Issue 4054] ICE(eh.c) line 49

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4054


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

   What|Removed |Added

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


--- Comment #2 from Don clugd...@yahoo.com.au 2010-04-02 22:35:29 PDT ---
See also bug 3753, which also triggers the same ICE.

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


[Issue 4055] ICE(tocsym.c:407) virtual Symbol* FuncDeclaration::toSymbol(): Assertion `0' failed.

2010-04-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4055


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

   What|Removed |Added

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


--- Comment #2 from Don clugd...@yahoo.com.au 2010-04-02 22:37:23 PDT ---
Duplicate of 3602?

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