[Issue 8849] std.parallelism.executeInNewThread with thread priority segfaults

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8849



--- Comment #1 from github-bugzi...@puremagic.com 2012-10-18 23:19:38 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/d4cce7be56a76c117ded75829d69e6b8603944f9
Fixes Issue 8849:  std.parallelism.executeInNewThread with thread priority
segfaults

https://github.com/D-Programming-Language/phobos/commit/f230a1653fdf412265d54e360563f64fb981abfd
Merge pull request #881 from dsimcha/master

Fix Issue 8849

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


[Issue 8849] std.parallelism.executeInNewThread with thread priority segfaults

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8849


Alex R�nne Petersen a...@lycus.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||a...@lycus.org
 Resolution||FIXED


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


[Issue 8852] New: Unable to join thread (started by another thread)

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8852

   Summary: Unable to join thread (started by another thread)
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: luka8...@owave.net


--- Comment #0 from luka8088 luka8...@owave.net 2012-10-19 00:28:36 PDT ---
module program;

import std.stdio;
import core.thread;

void main () {

  Thread t1, t2;

  t1 = new Thread(delegate { t2.start(); });
  t2 = new Thread(delegate { Thread.sleep(dur!seconds(1)); });

  t1.start();
  t2.join();

}

-

http://dpaste.dzfl.pl/0d24dd06

output:
  core.thread.ThreadException@src/core/thread.d(780): Unable to join thread

if t2.join occurs after t2 already finished then exception is not thrown, hence
the sleep

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


[Issue 8852] Unable to join thread (started by another thread)

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8852


Alex R�nne Petersen a...@lycus.org changed:

   What|Removed |Added

 CC||a...@lycus.org


--- Comment #1 from Alex R�nne Petersen a...@lycus.org 2012-10-19 09:29:58 
CEST ---
Possibly related to #8774.

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


[Issue 6116] May not join spawn()'ed threads

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6116


Alex R�nne Petersen a...@lycus.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC||a...@lycus.org
 Resolution||FIXED


--- Comment #5 from Alex R�nne Petersen a...@lycus.org 2012-10-19 09:31:01 
CEST ---
Closing this then. Please reopen if the bug resurfaces.

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


[Issue 8852] Unable to join thread (started by another thread)

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8852


luka8088 luka8...@owave.net changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #2 from luka8088 luka8...@owave.net 2012-10-19 00:32:12 PDT ---
(In reply to comment #1)
 Possibly related to #8774.

Yes, thank you for the note

*** This issue has been marked as a duplicate of issue 8774 ***

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


[Issue 8774] 2.059 worked 2.060 does not: Unable to join thread

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8774


luka8088 luka8...@owave.net changed:

   What|Removed |Added

 CC||luka8...@owave.net


--- Comment #7 from luka8088 luka8...@owave.net 2012-10-19 00:32:12 PDT ---
*** Issue 8852 has been marked as a duplicate of this issue. ***

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


[Issue 8774] 2.059 worked 2.060 does not: Unable to join thread

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8774



--- Comment #8 from luka8088 luka8...@owave.net 2012-10-19 00:33:58 PDT ---
Here is a simple test case:

-

module program;

import std.stdio;
import core.thread;

void main () {

  Thread t1, t2;

  t1 = new Thread(delegate { t2.start(); });
  t2 = new Thread(delegate { Thread.sleep(dur!seconds(1)); });

  t1.start();
  t2.join();

}

-

http://dpaste.dzfl.pl/0d24dd06

output:
  core.thread.ThreadException@src/core/thread.d(780): Unable to join thread

if t2.join occurs after t2 already finished then exception is not thrown, hence
the sleep

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


[Issue 8848] Array literals and AA literals are rejected as template value parameters

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8848



--- Comment #2 from Don clugd...@yahoo.com.au 2012-10-19 02:40:26 PDT ---
(In reply to comment #1)
 (In reply to comment #0)
  The template spec says that they are valid (both D1 and D2),
 
 So are associative arrays accepted, but simple arrays aren't?
 
 template Foo(int[] X) {}
 template Bar(int[5] X) {}
 void main() {}

No, the current DMD accepts neither arrays or AAs in declarations. But both can
be passed in template tuple parameters.

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


[Issue 8257] __traits(compiles) gives compile error

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8257


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

   What|Removed |Added

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


--- Comment #1 from Don clugd...@yahoo.com.au 2012-10-19 04:14:25 PDT ---
The error is not coming from __traits(compiles), it happens while generating
the obj file.
If you compile with dmd -c -o-
then no error occurs.

The error message itself should I think be regarded as an internal compiler
error.
Here's the root cause.

struct S { static void g() { } static int w;}
void main()
{
 S s;
 auto k = s.g;
 pragma(msg, typeof(s.g));
}
This compiles with -c -o-

According to the pragma, s.g is a delegate. But, since g is a static function,
it cannot be a valid delegate. The error is detected only at the glue layer.

I believe that s.g should be a function pointer, and s should be ignored,
since already:
int *x = s.w; // accepted, s is ignored
s.g(); // accepted, s is ignored.

This would mean the __traits in the original code would continue to return
true, but the function f!g() would actually be valid and would return a
function pointer, not a delegate.

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


[Issue 8836] function called with argument types ((void function())) matches both f(void function() fn) and f(void delegate() dg)

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8836


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

   What|Removed |Added

   Keywords||rejects-valid


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-10-19 06:49:29 PDT ---
Reduced test case:

int f(void function () fn) { return 1; }
int f(void delegate () dg) { return 2; }

void foo() {}  // unsafe, impure, and may throw
void main()
{
f({ foo(); });
}

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


[Issue 8836] function called with argument types ((void function())) matches both f(void function() fn) and f(void delegate() dg)

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8836


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

   What|Removed |Added

   Keywords||pull


--- Comment #2 from Kenji Hara k.hara...@gmail.com 2012-10-19 08:22:49 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1193

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


[Issue 8542] crosstalk between template instantiations

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8542


Jesse Phillips jesse.k.phillip...@gmail.com changed:

   What|Removed |Added

 CC||jesse.k.phillip...@gmail.co
   ||m


--- Comment #5 from Jesse Phillips jesse.k.phillip...@gmail.com 2012-10-19 
11:23:02 PDT ---
I may have duplicated this issue:

http://d.puremagic.com/issues/show_bug.cgi?id=8850

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


[Issue 8850] Nested struct creation by a template

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8850


Jesse Phillips jesse.k.phillip...@gmail.com changed:

   What|Removed |Added

 CC||jesse.k.phillip...@gmail.co
   ||m


--- Comment #1 from Jesse Phillips jesse.k.phillip...@gmail.com 2012-10-19 
11:24:26 PDT ---
May be duplicating or related to:
http://d.puremagic.com/issues/show_bug.cgi?id=8542

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


[Issue 8854] New: incomprehensible bug on windows with import side effect

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8854

   Summary: incomprehensible bug on windows with import side
effect
   Product: D
   Version: D2
  Platform: All
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: thelastmamm...@gmail.com


--- Comment #0 from thelastmamm...@gmail.com 2012-10-19 11:24:45 PDT ---
Created an attachment (id=1150)
zip containing all 4 files to reproduce bug 

I've attached a set of 4 files I've simplified as much as I could. This gives
rise to a very weird bug (only on windows 32 bits). Here's the contents of the
readme:

steps to reproduce bug:

cd to directory containing this readme
rdmd --force -I.\tests main

note:
dmd -I.\tests main main_aux1 tests/main_testfun and then running main still has
the bug

note:
any of the following changes will remove the bug (ie the assert will pass):

rename tests/main_testfun to tests/main_aux2 (or probably other stuff) and
reflecting this in main_testfun.d and the import statement in main.d)
rename directory tests to test123 (or something else) and reflecting this in
the -I flag
remove the (useless) import main_aux1; in main_testfun.d
remove the (useless) import std.stdio in main_aux1.d
replace assert([0].map!(a=b.length)[0]==1); by assert(b.length==1); in
main_testfun.d




├── main.d
├── main_aux1.d
├── readme.txt
└── tests
└── main_testfun.d


contents of each file:

cat main.d 

  
import main_testfun;
void main(){
testfun;
}


cat main_aux1.d

  
module main_aux1;
import std.stdio;//works wo this


cat tests/main_testfun.d   

  
module main_testfun;
import main_aux1;
import std.algorithm:map;

void testfun(){
auto b=[1];
assert([0].map!(a=b.length)[0]==1);
}


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


[Issue 8799] Give example of Tuple mapped to a function

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8799



--- Comment #1 from Jesse Phillips jesse.k.phillip...@gmail.com 2012-10-19 
11:28:57 PDT ---
Sorry I miss understood and did not remember that Tuples do auto expand. The
actual request is mapping the Tuple to a function, as requested on SO:

http://stackoverflow.com/questions/12888263/mapping-variadic-template-arguments-in-d

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


[Issue 8850] Nested struct creation by a template

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8850


monarchdo...@gmail.com changed:

   What|Removed |Added

 CC||monarchdo...@gmail.com


--- Comment #2 from monarchdo...@gmail.com 2012-10-19 13:14:58 PDT ---
(In reply to comment #0)
 I'm not sure the intended behavior but currently is inconsistent. The 
 following
 code fails to compile with:
 
 bad.d(2): Error: function D main is a nested function and cannot be accessed
 from bad.fun!(R).fun
 
 T fun(T)() if(is(T == struct)) {
 T s;
 return s;
 }
 
 void main() {
 struct R {
 void f() { }
 }
 
 auto m = fun!R();
 }
 
 However removing the function from the struct definition (include other values
 if desired) then it will compile. I'd think we'd want templates to have the
 ability to create a nested struct.

Nested structs keep a frame pointer (or something alike) to be able to access
anything inside main, from outside of main. As such, you can't use them (as is)
as a template parameter.

HOWEVER, you can declare your struct as static explicitly stating that the
struct does not keep any extra info, at which point it becomes useable:

T fun(T)() if(is(T == struct)) {
   T s;
   return s;
}

void main() {
   static struct R {
   void f() { }
   }

   auto m = fun!R();
}

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


[Issue 8850] Nested struct creation by a template

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8850


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

   What|Removed |Added

 CC||timon.g...@gmx.ch


--- Comment #3 from timon.g...@gmx.ch 2012-10-19 15:30:32 PDT ---
I think it is supposed to work, the following does work:

T fun(T, alias f)(){
T s;
return s;
}

void main() {
int x=2;
void f(){}
struct R { int f() { return x; } }
auto m = fun!(R,f)();
}

(The reason why it works is that the alias function parameter forces local
template instantiation.)

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


[Issue 4542] [tdpl] TDPL NVI example results in linker error

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4542



--- Comment #13 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-19 
15:35:23 PDT ---
What should have been done from day #1 is to implement the 'virtual' keyword
and make methods non-virtual by default. It goes hand in hand with 'override'.
I really don't know why virtual is on by default, maybe someone thought
polymorphism would be used a lot in D but it turns out templates are much
cooler to work with these days rather than OOP, just look at Phobos for
example. (ok the last part is highly subjective :) )

(In reply to comment #12)
 at the cost of performance in pretty much all programs.

I wonder what would happen to performance if we suddenly switched behavior and
made methods non-virtual by default (and require a 'virtual' keyword).

Of course you'd have to fix your code and add 'virtual' to base methods, but
this is practically an error-free refactoring since 'override' was already
required. You would get CT errors rather than weird runtime behavior (like
C++03).

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


[Issue 8856] New: import inside function sometimes causes link errors

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8856

   Summary: import inside function sometimes causes link errors
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: thelastmamm...@gmail.com


--- Comment #0 from thelastmamm...@gmail.com 2012-10-19 18:18:13 PDT ---
I sometimes get link errors eg:

void fun(){
import mypackage.mymodule;
mypackage.mymodule.myfun(); //might cause link error, depending on contents
of myfun
}

(cf http://forum.dlang.org/thread/xdonaxnahmonhyafh...@forum.dlang.org)

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


[Issue 8856] import inside function sometimes causes link errors

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8856


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

   What|Removed |Added

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


--- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-19 
18:44:09 PDT ---
We'll need a failing test-case. What contents cause the linker error?

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


[Issue 8856] import inside function sometimes causes link errors

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8856



--- Comment #2 from thelastmamm...@gmail.com 2012-10-19 20:18:49 PDT ---
(In reply to comment #1)
 We'll need a failing test-case. What contents cause the linker error?

here's a failure case which I simplified to the maximum.
Note that link error occurs with rdmd, not with dmd, as shown below. So that is
a problem with rdmd failing to find dependencies in some cases.


rdmd ${DFLAGS} main

=Undefined symbols for architecture x86_64:
_D9main_aux24fun1FZv, referenced from:
_D8main_aux4testFZv in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status


dmd ${DFLAGS} main main_aux main_aux2
= works


Here are the files:

.
├── main.d
├── main_aux.d
└── main_aux2.d

cat  main.d

import main_aux;
void main(){
test;
}   
cat main_aux.d
module main_aux;
//putting the main function here removes link error
//void main(){
//test;
//}

//import main_aux2; //uncomment removes link error
void test(){
import main_aux2;
fun1();
}

cat main_aux2.d
module main_aux2;
void fun1() {
}

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


[Issue 8856] import inside function sometimes causes link errors

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8856



--- Comment #3 from thelastmamm...@gmail.com 2012-10-19 20:20:57 PDT ---
In the above post, DFLAGS is just the usual import path to dmdroot/phobos,
druntime/import and phobos library path.

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


[Issue 8856] import inside function sometimes causes link errors

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8856



--- Comment #4 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-19 
20:34:14 PDT ---
(In reply to comment #2)
 snip

The problem is DMD's -v option doesn't output dependencies when an import is
function local.

test.d:
module test;
import foo;
void main() { }

foo.d:
module foo;
import bar;

bar.d is empty

$ dmd -c -v test.d
 importfoo   (foo.d)
 importbar   (bar.d)

Now use a local import in foo.d:

foo.d:
module foo;
void loc() { import bar; }

$ dmd -c -v test.d
 importfoo   (foo.d)

DMD doesn't output the import to bar.d when using -v. That has to be fixed.

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


[Issue 8549] Bad error message with const methods

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8549


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||andrej.mitrov...@gmail.com
 Resolution||DUPLICATE


--- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-19 
20:57:41 PDT ---
Issue6707 covers this, the error message is now:

test.d(11): Error: function test.Foo.opSlice () is not callable using argument
types () const

*** This issue has been marked as a duplicate of issue 6707 ***

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


[Issue 6707] Error message for mismatch of const/non-const property functions needs to improve

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6707


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

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #3 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-19 
20:57:42 PDT ---
*** Issue 8549 has been marked as a duplicate of this issue. ***

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


[Issue 8549] Bad error message with const methods

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8549



--- Comment #2 from bearophile_h...@eml.cc 2012-10-19 21:36:07 PDT ---
(In reply to comment #1)
 Issue6707 covers this, the error message is now:

I agree with closing this as dupe.

But I think adding const at the end is not nearly enough to make the error
message clear.

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


[Issue 8549] Bad error message with const methods

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8549



--- Comment #3 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-19 
21:40:56 PDT ---
(In reply to comment #2)
 (In reply to comment #1)
  Issue6707 covers this, the error message is now:
 
 I agree with closing this as dupe.
 
 But I think adding const at the end is not nearly enough to make the error
 message clear.

I would take a bigger pull to fix this since there's a lot of code duplication
in DMD. Personally I would change the message to:

Error: function test.Foo.opSlice () is not callable using const(this)

What do you think?

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


[Issue 8549] Bad error message with const methods

2012-10-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8549



--- Comment #4 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-19 
21:41:21 PDT ---
(In reply to comment #3)
 I would take

*It* would take.

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