[Issue 4987] C function pointer syntax needs to be deprecated

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4987


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2010-10-05 
00:19:23 PDT ---
I changed it for D2 only, in order to avoid breaking existing D1 code.

http://www.dsource.org/projects/dmd/changeset/703

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


[Issue 4961] ICE on Tuple in union as part of static struct member

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4961


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

   What|Removed |Added

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


--- Comment #1 from Don clugd...@yahoo.com.au 2010-10-05 01:56:06 PDT ---
Reduced test case shows it doesn't require tuples.

struct Fields4961 { int x; }
struct bar4961 {
union {
   int[1] value;
   Fields4961 fields;
}

this( int r ) {
   fields.x = r;   
}
}
static bar4961 b4961 = bar4961( 0 );

Interestingly, if you swap 'value' and 'fields', you get an error message with
no line number:

Error: duplicate union initialization for value

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


[Issue 4992] ICE(glue.c) or segfault: using int[new]

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4992


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

   What|Removed |Added

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


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2010-10-05 
02:34:15 PDT ---
http://www.dsource.org/projects/dmd/changeset/704

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


[Issue 4953] Regression(2.031): templates don't do implicit conversion properly

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4953


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

   What|Removed |Added

Summary|opBinary, opBinaryRight |Regression(2.031):
   |don't do implicit   |templates don't do implicit
   |conversion properly |conversion properly
   Severity|normal  |regression


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


[Issue 4692] Cyclic import breaks is() in a static if in a struct

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4692


William Moore nyphb...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #2 from William Moore nyphb...@gmail.com 2010-10-05 07:45:47 PDT 
---
This seems to be fixed in the latest DMD 1.064.

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


[Issue 4996] New: When D's dll unloaded, writeln(stdout) doesn't work well.

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4996

   Summary: When D's dll unloaded, writeln(stdout) doesn't work
well.
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: druntime
AssignedTo: s...@invisibleduck.org
ReportedBy: zan77...@nifty.com


--- Comment #0 from SHOO zan77...@nifty.com 2010-10-05 09:31:02 PDT ---
When D's dll unloaded, writeln(stdout) doesn't work well.
I guess that druntime's dll termination was failure.
Or, my miss. Do you understand this cause?

 dll.d -
import std.c.windows.windows;
import core.dll_helper;

__gshared HINSTANCE g_hInst;

extern (Windows)
BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
{
switch (ulReason)
{
case DLL_PROCESS_ATTACH:
g_hInst = hInstance;
dll_process_attach( hInstance, true );
break;

case DLL_PROCESS_DETACH:
dll_process_detach( hInstance, true );
break;

case DLL_THREAD_ATTACH:
dll_thread_attach( true, true );
break;

case DLL_THREAD_DETACH:
dll_thread_detach( true, true );
break;
}
return true;
}


- main.d ---

import std.stdio;
import core.runtime;

void main()
{
writeln(???);
auto h = Runtime.loadLibrary(dll.DLL);
Runtime.unloadLibrary(h);
writeln(!!!);
}


 module.def ---
LIBRARY DLL
DESCRIPTION 'DLL Module'

EXETYPE NT
CODEPRELOAD DISCARDABLE
DATAWRITE

EXPORTS

- RESULT ---
$ dmd module.def dll.d

$ dmd -run main.d
???

- (END) --

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


[Issue 4982] Repeating same error message thousands of times due to brute forcing matching symbol name

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4982


Stewart Gordon s...@iname.com changed:

   What|Removed |Added

   Keywords|ice-on-invalid-code |rejects-valid


--- Comment #3 from Stewart Gordon s...@iname.com 2010-10-05 09:56:50 PDT ---
Well, obviously, but that isn't part of the bug being reported.  But I've just
found that the same happens with it in.

And I've just had a closer look at the output, and realise it's the spellcheck
facility seeing if there's something closely resembling the symbol it thinks is
undefined.  So the loop isn't infinite.  Though DMD's notion of closely
resembling puzzles me: if I reduce the name to s then it tries a total of
16130 of them.

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


[Issue 4996] When D's dll unloaded, writeln(stdout) doesn't work well.

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4996


Rainer Schuetze r.sagita...@gmx.de changed:

   What|Removed |Added

 CC||r.sagita...@gmx.de


--- Comment #1 from Rainer Schuetze r.sagita...@gmx.de 2010-10-05 11:57:22 
PDT ---
This is a problem of the C runtime library. See bug 1550.

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


[Issue 4873] Assertion failure: '0' on line 1483 in file 'expression.c'

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4873


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

   What|Removed |Added

   Keywords||patch


--- Comment #2 from Don clugd...@yahoo.com.au 2010-10-05 12:30:28 PDT ---
PATCH: staticassert.c, line 58.

void StaticAssert::semantic2(Scope *sc)
{
Expression *e;

//printf(StaticAssert::semantic2() %s\n, toChars());
e = exp-semantic(sc);
+if (e-op == TOKerror)
+return;
e = e-optimize(WANTvalue | WANTinterpret);
if (e-isBool(FALSE))

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


[Issue 4728] Crash by protected/private constructor in an other module

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4728


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

   What|Removed |Added

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


--- Comment #1 from Don clugd...@yahoo.com.au 2010-10-05 14:04:32 PDT ---
I cannot reproduce this. For me on Windows, it prints the error message, but
does not crash. Perhaps the test case is slightly wrong?

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


[Issue 4997] New: names, values, length and basetype enum properties

2010-10-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4997

   Summary: names, values, length and basetype enum properties
   Product: D
   Version: D2
  Platform: All
OS/Version: All
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-10-05 14:33:13 PDT ---
This D2 program shows how to find some info about an enum:


import std.stdio: writeln;
import std.traits: EnumMembers;

enum MyEnum : ushort {
FOO  = 10,
BAR  = 20,
BAZ  = 40,
SPAM = 30
}

void main() {
writeln(First enum member value: , MyEnum.init);
writeln(Smallest value of enum: , MyEnum.min);
writeln(Largest value of enum: , MyEnum.max);
writeln(Size of storage for an enumerated value: , MyEnum.sizeof);
writeln(Number of enum members: , __traits(allMembers, MyEnum).length);

static if (is(MyEnum V == enum))
writeln(Enum Base Type: , V.stringof);

string[] names = [__traits(allMembers, MyEnum)];
writeln(Enum names as strings: , names);

MyEnum[] values = [EnumMembers!MyEnum];
writeln(Enum values: , values);
}


Its output:

First enum member value: 10
Smallest value of enum: 10
Largest value of enum: 40
Size of storage for an enumerated value: 2
Number of enum members: 4
Enum Base Type: ushort
Enum names as strings: [FOO, BAR, BAZ, SPAM]
Enum values: [10, 20, 40, 30]


EnumMembers and __traits(allMembers) are useful, but they are scattered, so the
programmer has to know about them, where to find them, their syntax and usage.
It's better to have this information close where it's needed. A more handy
place to put such information is as built-in properties of all enums. So to
find that information you just need something like:


import std.stdio: writeln;

enum MyEnum : ushort {
FOO  = 10,
BAR  = 20,
BAZ  = 40,
SPAM = 30
}

void main() {
writeln(First enum member value: , MyEnum.init);
writeln(Smallest value of enum: , MyEnum.min);
writeln(Largest value of enum: , MyEnum.max);
writeln(Size of storage for an enumerated value: , MyEnum.sizeof);
writeln(Number of enum members: , MyEnum.length);
writeln(Enum Base Type: , MyEnum.basetype.stringof);
writeln(Enum names as strings: , MyEnum.names);
writeln(Enum values: , MyEnum.values);
}


So this enhancement request asks for four enum properties, that may be named
(but other names are possible):

length, basetype names and values.


But keep in mind of possible name clashes (that are quite possible with the
current enum design too):

enum MyEnum2 {
init,
length,
max,
min,
}


A possible way to avoid this problem is to *forbid* the presence of a single
member name like meta, and then use only it to access all the enum info:


import std.stdio: writeln;

enum MyEnum : ushort {
FOO  = 10,
BAR  = 20,
BAZ  = 40,
SPAM = 30
}

void main() {
writeln(First enum member value: , MyEnum.meta.init);
writeln(Smallest value of enum: , MyEnum.meta.min);
writeln(Largest value of enum: , MyEnum.meta.max);
writeln(Size of storage for an enumerated value: , MyEnum.meta.sizeof);
writeln(Number of enum members: , MyEnum.meta.length);
writeln(Enum Base Type: , MyEnum.basetype.meta.stringof);
writeln(Enum names as strings: , MyEnum.meta.names);
writeln(Enum values: , MyEnum.meta.values);
}

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