[Issue 9063] static assert should resolve property function call

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9063



--- Comment #2 from github-bugzi...@puremagic.com 2012-11-23 03:19:58 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1ac1c9a09511f8e3068f8cc67ed74839803f6e24
fix Issue 9063 - static assert should resolve property function call

https://github.com/D-Programming-Language/dmd/commit/58112859e0903fc020fee37d5647189de8370654
Merge pull request #1309 from 9rnsr/fix9063

Issue 9063 - static assert should resolve property function call

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


[Issue 9062] AddrExp should distinguish the existence of property resolution.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9062


d...@dawgfoto.de changed:

   What|Removed |Added

 CC||d...@dawgfoto.de


--- Comment #3 from d...@dawgfoto.de 2012-11-23 03:30:57 PST ---
If @property is all about equivalence of fields and accessors, then &foo should
not return a function pointer. IMHO obtaining the funtion pointer should be the
special case.

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


[Issue 9062] AddrExp should distinguish the existence of property resolution.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9062



--- Comment #4 from Kenji Hara  2012-11-23 04:57:35 PST ---
(In reply to comment #3)
> If @property is all about equivalence of fields and accessors, then &foo 
> should
> not return a function pointer.

Then, there is no way to get a function pointer from property function, right?


> IMHO obtaining the funtion pointer should be the
> special case.

std.traits.FunctionTypeOf!(property_func) is a special case?

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


[Issue 9062] AddrExp should distinguish the existence of property resolution.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9062


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

   What|Removed |Added

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


--- Comment #5 from timon.g...@gmx.ch 2012-11-23 05:00:33 PST ---
Property functions should always be called regardless of context.

int g;
@property ref int foo() { return g; }

pragma(msg, typeof( & foo  ));  // will print "int*"
pragma(msg, typeof( &(foo) ));  // will print "int*"

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


[Issue 9062] AddrExp should distinguish the existence of property resolution.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9062



--- Comment #6 from timon.g...@gmx.ch 2012-11-23 05:04:00 PST ---
(In reply to comment #4)
> (In reply to comment #3)
> > If @property is all about equivalence of fields and accessors, then &foo 
> > should
> > not return a function pointer.
> 
> Then, there is no way to get a function pointer from property function, right?
> ...

()ref => foo

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


[Issue 9062] AddrExp should distinguish the existence of property resolution.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9062



--- Comment #7 from Kenji Hara  2012-11-23 05:32:10 PST ---
(In reply to comment #6)
> > Then, there is no way to get a function pointer from property function, 
> > right?
> > ...
> 
> ()ref => foo

It looks like a lambda. Is it same as this?

  ref __lambda() { return foo; }

But, on the return statement, foo is translated to foo(). It seems not
possible.

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


[Issue 9064] New: Add isInstanceOf to std.traits

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9064

   Summary: Add isInstanceOf to std.traits
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: andrej.mitrov...@gmail.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic  2012-11-23 
05:44:31 PST ---
struct Foo(T...) { }
struct Bar(T...) { }

void main()
{
static assert(isInstanceOf!(Foo, Foo!int));
static assert(!isInstanceOf!(Foo, Bar!int));
static assert(!isInstanceOf!(Foo, int));
static assert(!__traits(compiles, isInstanceOf!(Foo, Foo)));
}

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


[Issue 9062] AddrExp should distinguish the existence of property resolution.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9062



--- Comment #8 from timon.g...@gmx.ch 2012-11-23 05:41:30 PST ---
(In reply to comment #7)
> (In reply to comment #6)
> > > Then, there is no way to get a function pointer from property function, 
> > > right?
> > > ...
> > 
> > ()ref => foo
> 
> It looks like a lambda. Is it same as this?
> 
>   ref __lambda() { return foo; }
> 

Yes, it is the same as &__lambda, where __lambda is

static ref __lambda() { return foo; }

(the fact that the parser chokes on ref-qualified function/delegate literals
and function/delegate types is another bug.)

> But, on the return statement, foo is translated to foo(). It seems not
> possible.

&__lambda is a function pointer.

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


[Issue 9055] [CTFE] Compiler segfaults on paren-free auto-return forward referenced member function call on nonexistent 'this' receiver

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9055


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

   What|Removed |Added

   Keywords||CTFE
 CC||timon.g...@gmx.ch
Summary|Compiler bails out on   |[CTFE] Compiler segfaults
   |initializing a variable |on paren-free auto-return
   ||forward referenced member
   ||function call on
   ||nonexistent 'this' receiver


--- Comment #4 from timon.g...@gmx.ch 2012-11-23 05:53:32 PST ---
Reduced test case:

class C{
enum a=this.b;
auto b(){ return 0; }
}

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


[Issue 9064] Add isInstanceOf to std.traits

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9064


Andrej Mitrovic  changed:

   What|Removed |Added

   Keywords||pull


--- Comment #1 from Andrej Mitrovic  2012-11-23 
06:02:54 PST ---
https://github.com/D-Programming-Language/phobos/pull/970

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


[Issue 9065] New: Please consider adding these std.traits

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9065

   Summary: Please consider adding these std.traits
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: turkey...@gmail.com


--- Comment #0 from Manu  2012-11-23 06:06:00 PST ---
I'm constantly writing static logic code where I have no real idea what I'm
really doing, and when I finally get it working, it's unreadable.
This usually involves lots of careful is()-ing and __traits-ing.

I'd really appreciate these templates added to std.traits:

Tell me if T is a variable; ie, has a value, has an address (not an enum), ...
template isVariable(alias T) { ... }

Tell me if T is a function definition, not just if I can call it. I can easily
find if something is a function pointer/delegate, or a method, or virtual, or
abstract, or various other function related details, but surprisingly, not if T
is just a function definition or not.
template isFunctionDefinition(alias T) { ... }

I want to know if I is an instance of some template T.
template isInstanceOf(alias T, I) { ... }

Perhaps like this: http://dpaste.dzfl.pl/fedac944

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


[Issue 9062] AddrExp should distinguish the existence of property resolution.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9062



--- Comment #9 from Kenji Hara  2012-11-23 06:06:46 PST ---
(In reply to comment #8)
[snip]

OK, I understood what you say. But implementing it in library might be much
difficult...

---
// An experimental implementation of timon's idea.
template PropertyTypeOf(alias prop)
{
auto ref wrapper()(){ return prop(); }
alias PropertyTypeOf = typeof(&wrapper!());
}

/*@property*/ int foo() @trusted nothrow { return 10;}
pragma(msg, PropertyTypeOf!foo);
// -> int function() nothrow @safe  (not @trusted)

void main()
{
struct S { /*@property*/ string bar() pure { return ""; } }
pragma(msg, PropertyTypeOf!(S.bar));
// -> Error...
}
---

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


[Issue 9062] AddrExp should distinguish the existence of property resolution.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9062



--- Comment #10 from timon.g...@gmx.ch 2012-11-23 06:54:28 PST ---
(In reply to comment #9)
> (In reply to comment #8)
> [snip]
> 
> OK, I understood what you say. But implementing it in library might be much
> difficult...
> 
> ---
> // An experimental implementation of timon's idea.
> template PropertyTypeOf(alias prop)
> {
> auto ref wrapper()(){ return prop(); }
> alias PropertyTypeOf = typeof(&wrapper!());
> }
> 
> /*@property*/ int foo() @trusted nothrow { return 10;}
> pragma(msg, PropertyTypeOf!foo);
> // -> int function() nothrow @safe  (not @trusted)
> 
> void main()
> {
> struct S { /*@property*/ string bar() pure { return ""; } }
> pragma(msg, PropertyTypeOf!(S.bar));
> // -> Error...
> }
> ---

I am not sure what you are trying to do here. Anyways, the following should
work:

template PropertyTypeOf(alias prop) {
alias PropertyTypeOf = typeof(()auto ref=>prop);
}

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


[Issue 8997] template instances omit symbol that may be used in other modules

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8997


Rainer Schuetze  changed:

   What|Removed |Added

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


--- Comment #1 from Rainer Schuetze  2012-11-23 10:48:01 
PST ---
https://github.com/D-Programming-Language/dmd/pull/1313

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


[Issue 9066] Implement constructor forwarding template

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9066



--- Comment #1 from Andrej Mitrovic  2012-11-23 
11:02:46 PST ---
Created an attachment (id=1165)
code

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


[Issue 9066] New: Implement constructor forwarding template

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9066

   Summary: Implement constructor forwarding template
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic  2012-11-23 
11:02:26 PST ---
This would alleviate the need to write boilerplate code by hand, e.g.:

class MyException : Exception
{
mixin ForwardCtors;
}

An experimental implementation is provided in the attachment.

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


[Issue 9067] New: Can't assign values from privately included modules to enums.

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9067

   Summary: Can't assign values from privately included modules to
enums.
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: g...@boloneum.com


--- Comment #0 from Gor Gyolchanyan  2012-11-23 11:26:38 PST 
---
Here's a pair of code, the first of which doesn't compile and the second of
which does compile.

//--

module foo;

public:
enum Count
{
one = bar.one,
two = bar.two,
three = bar.three,
}

private:
import bar;

// foo.d(6): Error: undefined identifier bar.one

//--

module foo;

public:
import bar;

enum Count
{
one = bar.one,
two = bar.two,
three = bar.three,
}

//--

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


[Issue 9068] New: ICE when trying to break outer loop from inside switch statement

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9068

   Summary: ICE when trying to break outer loop from inside switch
statement
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: Linux
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: hst...@quickfur.ath.cx


--- Comment #0 from hst...@quickfur.ath.cx 2012-11-23 16:09:18 PST ---
import std.range;
import std.stdio;

void main() {
X: foreach (l; stdin.byLine()) {
switch(l.front) {
case 'q':
break X;
default:
}
}
}

With latest git dmd:

Internal error: s2ir.c 731

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


[Issue 9012] writef/format inconsistent with format specifier

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9012


hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx


--- Comment #2 from hst...@quickfur.ath.cx 2012-11-23 16:22:35 PST ---
std.string.xformat is the function that's compatible with std.format. We really
should deprecate std.string.format or something, and replace it with xformat.
The current std.string.format sucks and every now and then causes newbie
confusion when the same format string works in writeln but not in
std.string.format (or it works differently).

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


[Issue 8602] Assertion failure

2012-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8602


hst...@quickfur.ath.cx changed:

   What|Removed |Added

   Severity|normal  |major


--- Comment #1 from hst...@quickfur.ath.cx 2012-11-23 16:30:34 PST ---
This is an internal compiler error; it deserves some attention.

Also, confirmed that it still happens in latest git dmd.

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