[Issue 6390] [CTFE] Struct constructor fails to call another method

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6390


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||DUPLICATE


--- Comment #1 from Don clugd...@yahoo.com.au 2011-07-28 00:04:05 PDT ---
Already fixed in git master.

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

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


[Issue 6337] [CTFE] ICE when touching member variable of struct during CTFE

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6337


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

   What|Removed |Added

 CC||bugzi...@kyllingen.net


--- Comment #3 from Don clugd...@yahoo.com.au 2011-07-28 00:04:06 PDT ---
*** Issue 6390 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 6345] A different kind of vector operation

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6345


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

   What|Removed |Added

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


--- Comment #3 from Don clugd...@yahoo.com.au 2011-07-28 00:36:12 PDT ---
All these operations require the use of strided slices, which would be a huge
amount of work to implement. Also, there are a plethora of corner cases.

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


[Issue 5667] [GSoC] clear does not call destructors on structs embedded in structs

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5667



--- Comment #9 from Cristi Cobzarenco cristi.cobzare...@gmail.com 2011-07-28 
04:07:39 PDT ---
Created a pull request with the fix and a unittest.

https://github.com/D-Programming-Language/druntime/pull/45

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


[Issue 6345] A different kind of vector operation

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6345



--- Comment #4 from bearophile_h...@eml.cc 2011-07-28 05:15:59 PDT ---
(In reply to comment #3)
 All these operations require the use of strided slices, which would be a huge
 amount of work to implement. Also, there are a plethora of corner cases.

I see. Those corner cases are bad. If you think this is too much work for the
gain I'll close this enhancement request, to leave similar functionalities to
matrix libraries.

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


[Issue 5728] rol in core.bitop

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5728



--- Comment #1 from bearophile_h...@eml.cc 2011-07-28 05:35:18 PDT ---
Now DMD too is able to figure by itself when a rol is needed, but I think I'd
like the instrinsic still:

https://github.com/D-Programming-Language/dmd/commit/32ea0206dead162f564689339b6c43212042643c

https://github.com/D-Programming-Language/dmd/commit/25df0466ab3ed9d36c354da7576e39f0c64663a5

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


[Issue 4333] Cannot use tuple of local symbols in constraint nor static if

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4333



--- Comment #4 from yebblies yebbl...@gmail.com 2011-07-28 23:51:23 EST ---
(In reply to comment #3)
 No, it still doesn't work. I tried making a template and passing it a tuple of
 mixed literals and local variable names and the same error occurred.

Please post a test case if you have one.

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


[Issue 4333] Cannot use tuple of local symbols in constraint nor static if

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4333



--- Comment #5 from Gor Gyolchanyan g...@boloneum.com 2011-07-28 07:09:35 PDT 
---
Created an attachment (id=1014)
A struct, using which causes some problems.

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


[Issue 4333] Cannot use tuple of local symbols in constraint nor static if

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4333



--- Comment #6 from Gor Gyolchanyan g...@boloneum.com 2011-07-28 07:10:37 PDT 
---
(In reply to comment #4)
 (In reply to comment #3)
  No, it still doesn't work. I tried making a template and passing it a tuple 
  of
  mixed literals and local variable names and the same error occurred.
 
 Please post a test case if you have one.

Can't reproduce that problem ATM, but another problem was discovered:

Hsec[] test(items...)()
{
return Hsec(items);
}

unittest
{
int i;
float f;
char c;

foreach(z;  test!(5, i, 2.3f, f, 'a', c))
{
writeln(z.type,  , z.kind);
}
}

this code causes DMD to crash.

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


[Issue 6392] New: function pointers should be convertible to delegates

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6392

   Summary: function pointers should be convertible to delegates
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: Windows
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: g...@boloneum.com


--- Comment #0 from Gor Gyolchanyan g...@boloneum.com 2011-07-28 07:43:45 PDT 
---
if a delegate is a fat pointer, containing the context pointer and the function
pointer, why isn't it legal to have a context pointer of null, allowing any
function to be viewed as a delegate? It will save lots of effort, making
duplicates of code for function pointers and delegates. To resolve the problem
of the hidden context parameter of the delegate function, for example, a simple
test for null may be used to determine whether the context pointer should be
passed or not.

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


[Issue 6392] function pointers should be convertible to delegates

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6392


Steven Schveighoffer schvei...@yahoo.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||schvei...@yahoo.com
 Resolution||WONTFIX


--- Comment #1 from Steven Schveighoffer schvei...@yahoo.com 2011-07-28 
07:53:59 PDT ---
There is already a library solution: 
http://www.d-programming-language.org/phobos/std_functional.html#toDelegate

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


[Issue 4476] __traits for more kinds of names

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4476


Gor Gyolchanyan g...@boloneum.com changed:

   What|Removed |Added

 CC||g...@boloneum.com


--- Comment #2 from Gor Gyolchanyan g...@boloneum.com 2011-07-28 08:08:18 PDT 
---
(In reply to comment #0)
 This is relative to page 22 of The D Programming Language.
 
 This piece of D2 code shown in the book instantiates a class defined inside 
 the
 current module named stats:
 Object.factory(stats. ~ arg);
 
 Generally in code it's better to apply the DRY principle, avoiding to 
 duplicate
 information that later can get out of sync (in this case a change in the 
 module
 name breaks the code inside the module).
 
 This currently works (dmd v2.047), but it's not nice, and performs run-time
 computations for something that is known statically (maybe there are already
 better ways to do it):
 
 Object.factory(split(to!string({class C {}; return new C;}()), .)[0] ~
 .Foo);
 
 The problem can be solved with few traits, able to tell at compile-time:
 __traits(thisModuleName) : the name of the current module.
 __traits(thisStructName) : the name of the current struct (where this line is
 contained), useful to create its toString that shows the struct name too.
 __traits(thisClassName) : the name of the current class (this can be found 
 with
 this.classinfo.name, but there is no need to compute it at runtime).
 __traits(thisFunctionName) : the name of the current function, useful for CTFE
  string mixins.
 
 Possibly there are already ways to find such strings at compile-time, but
 having a simple standard way to do it is good (better than having magic
 variables like __function_name__). Some more power of static introspection can
 be very useful in D.

Ha(In reply to comment #1)
 Just another workaround/hack:
 
 module modulename;
 class C{}
 void main(){
 Object obj = Object.factory(.stringof[7..$] ~.C);
 }

.stringof[7..$] is a 100% guarantee to get the module name, but if the module
name coincides with anything inside it, problems will occur:

module main;

struct S
{
}

void main()
{
mixin(`alias `~.stringof[7..$]~`.S MyStruct;`); // ERROR: function main
does not have a struct in it
}

What i suggest is to have traits to get the aliases for the current module and
current function. the current struct and class can be taken by typeof(this) and
typeof(this).stringof. Thus the current function name will be accessible
through __traits(thisFunction).stringof.

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


[Issue 6393] allow undefined aliases as template parameters and alias tuples

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6393



--- Comment #1 from Gor Gyolchanyan g...@boloneum.com 2011-07-28 08:38:52 PDT 
---
Also i would suggest to disallow passing arbitrary aliases into variadic
templates like:

template foo(Item...)
{
}

and allow only type names, because the similar non-variadic declaration:

template bar(Item)
{
}

means, that bar takes a single type.
to resolve the issue of variadic alias templates, a simple syntax may be used,
like:

template buzz(alias... items)
{
}

or

template buzz(alias items...)
{
}

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


[Issue 6393] New: allow undefined aliases as template parameters and alias tuples

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6393

   Summary: allow undefined aliases as template parameters and
alias tuples
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: Windows
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: g...@boloneum.com


--- Comment #0 from Gor Gyolchanyan g...@boloneum.com 2011-07-28 08:35:50 PDT 
---
There are times, when a template needs to take an identifier as a parameter to
bind that identifier with something. For example:

mixin template aliasInt(string name)
{
mixin(`alias int `~name~`;`);
}

This sure does what it says and the D identifier string literal reflects the
nature of the string being passed, but the problems gets very complicated when
using complex static conditions, which force you to wrap the entire template
body into a mixin just because you need an identifier.

I suggest to allow undefined aliases as template parameters and add a
__traits(defined, ...), which tests if the given aliases are defined or not.
in that case the above ugly template becomes small, clean and cute:

mixin template Test(alias name)
{
alias int name;
}

but that would force everybody else to add another template constraint to
ensure, that the alias they are receiving is valid, unless they already do
check it for being a type, a function or something similar.

another way of doing this is to add a new construct, called a symbol. A
symbol would be a compile-time only value, which holds a string literal of D
identifier format. It can be declared as:

symbol a = hello;

where hello is actually a string literal and thus, need not be a valid alias.
The key difference of a symbol from a string literal is, that the symbol will
behave exactly like an alias (allow to take the type of the symbol if it's a
variable, use it in the isExpression if it's a type, etc..).
If the symbol is initialized by or assigned an alias, then it will be have as
an alias, but if it's initialized by an undefined identifier, it behaves more
like a string.
a symbol would be able to be assigned an alias, in which case it would
essentially get it's name:

symbol a = writeln;
// is same as:
symbol b = writeln.stringof;

any other kind of strings would be illegal to assign to a symbol value.
the symbol is always compile-time and could be read from CTFE freely and be
able to be rebound.

this also removes some problems in the world of compile-time refection: Some
traits take and return strings, representing names, some take aliases and some
return functions (not function pointers), which can't be aliased.

For example, the __traits(getOverloads, ...) returns the functions themselves.
They can only be iterated over in a foreach. returning a string is useless,
because then the types of the overloads would be impossible to test. returning
symbols will allow to save them (possibly in an array or a tuple) and reuse
later.

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


[Issue 6394] New: template type constraints embedded in the function parameters.

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6394

   Summary: template type constraints embedded in the function
parameters.
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: g...@boloneum.com


--- Comment #0 from Gor Gyolchanyan g...@boloneum.com 2011-07-28 08:43:43 PDT 
---


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


[Issue 6394] template type constraints embedded in the function parameters.

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6394



--- Comment #1 from Gor Gyolchanyan g...@boloneum.com 2011-07-28 08:49:18 PDT 
---
Given the code:

---

template SomeStruct(Type)
{
static if(is(Type == struct) || is(Type == class) || is(Type == interface))
enum StaticStruct = true;
else
enum StaticStruct = false;
}

---

I suggest a syntax sugar for template functions:

---

void f(SomeStruct s)
{
}

---

be transformed into:

---

void f(Type_0_)(Type_0_ s)
if(SomeStruct!Type_0_)
{
}

---

IF the given type isn't a valid type, it'll search for a template, that takes a
single type and evaluates to a bool and transform the function if the type name
is such a template.

this would greatly increase the readability of generic functions and allow to
avoid creating enormous template constraints, as well as provide a better
diagnostics, like the type T is not a SomeStruct or something like that.

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


[Issue 6373] More descriptive 'hidden by X is deprecated' error

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6373


klickverbot c...@klickverbot.at changed:

   What|Removed |Added

   Keywords||patch
 CC||c...@klickverbot.at


--- Comment #4 from klickverbot c...@klickverbot.at 2011-07-28 10:40:11 PDT 
---
Besides the fact that pull requests are preferred for cases where you are
reasonably sure that you patch is worth closer inspection/inclusion, please use
the unified diff format (diff -u) for patches. It it the de-facto standard in
the open source world and makes it easier to review changes.

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


[Issue 6395] New: Multiple-at-a-time bug breaking e.g. DustMite

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6395

   Summary: Multiple-at-a-time bug breaking e.g. DustMite
   Product: D
   Version: D2
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: c...@klickverbot.at


--- Comment #0 from klickverbot c...@klickverbot.at 2011-07-28 10:55:29 PDT 
---
The test case, reduced as much as I easily could achieve (I spent too much time
on this already, maybe I've missed something obvious):

a.d:
---
import c;
---

b.d:
---
import c;

int regex(string pattern)
{
  return 0;
}

bool match(string r)
{
  return true;
}

void applyNoRemoveRegex()
{
  void scan(string[] noRemoveStr, string e)
  {
auto a = find!((a){return match(e);})(map!regex(noRemoveStr));
  }
}
---

c.d:
---
template map(alias fun) {
  auto map(Range)(Range r) {
struct Result
{
  @property auto ref front()
  {
return fun(a);
  }
}
return Result();
  }
}

Range find(alias pred, Range)(Range haystack) {
  pred(haystack.front);
  return haystack;
}
---

$ dmd -c a.d b.d
Assertion failed: (!vthis-csym), function toObjFile, file glue.c, line 719.
Abort trap: 6

If you reverse the source files in the dmd parameter list, the example compiles
fine.

The bug was found by trying to compile DustMite with DMD 2.054
(https://github.com/CyberShadow/DustMite/wiki/Building-DustMite).

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


[Issue 6395] Multiple-at-a-time bug breaking e.g. DustMite

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6395



--- Comment #1 from kenn...@gmail.com 2011-07-28 11:27:13 PDT ---
Bug 5754?

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


[Issue 6395] Multiple-at-a-time bug breaking e.g. DustMite

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6395



--- Comment #2 from klickverbot c...@klickverbot.at 2011-07-28 11:29:40 PDT 
---
Probably related, yes, but I don't know if it is really the same bug, as it
depends on multiple modules, etc.

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


[Issue 6396] New: enums + struct initializers == wrong code

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6396

   Summary: enums + struct initializers == wrong code
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: wrong-code
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2011-07-28 12:40:37 PDT ---
struct S {
bool b;
double d = 3.14159265;
int i = 42;
}

enum S s = {b : true};

void main() {
import std.stdio;
writeln(s.d);  // nan
writeln(s.i);  // 0
}

Changing the enum to immutable fixes this.

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


[Issue 6397] New: D1: Empty const string causes bad obj

2011-07-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6397

   Summary: D1: Empty const string causes bad obj
   Product: D
   Version: D1
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: cbkbbej...@mailinator.com


--- Comment #0 from Nick Sabalausky cbkbbej...@mailinator.com 2011-07-28 
14:05:10 PDT ---
const a = ;

void main()
{
auto x = a;
}

 dmd testEmptyStringLink.d
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
testEmptyStringLink.obj(testEmptyStringLink)  Offset 00180H Record Type 009D
 Error 16: Index Range
--- errorlevel 1

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