digitalmars.D.learn - What am I doing wrong here?
- Martin (28/28) Oct 14 2012 Hey everyone, I'm new to D so bare with me please. I've been
- Simen Kjaeraas (6/33) Oct 14 2012 It's a bug. Maybe it's already in Bugzilla (there are some forward-ref
- Martin (3/43) Oct 14 2012 Oh, thank you for clarifying, I thought I was doing something
Hey everyone, I'm new to D so bare with me please. I've been
trying to figure out what's up with the strange forward refernce
errors the compiler (DMD 2.060) is giving me. Here's a code
snippet that's generating a forward reference error:
public class AliasTestClass(alias func)
{
static assert(__traits(isStaticFunction, func));
}
public class TestClass
{
private AliasTestClass!(randomFunction) test; // <-----
public static void randomFunction()
{
}
}
The strange part about it is that if I surround the
randomFunction parameter with another pair of paranthesis like so
private AliasTestClass!((randomFunction)) test;
It works just fine. If I don't, however, I get a forward
reference error:
"Error: template instance main.AliasTestClass!(randomFunction)
forward reference of randomFunction"
Am I doing anything wrong or is this some kind of bug?
Oct 14 2012
On 2012-10-14, 14:28, Martin wrote:
Hey everyone, I'm new to D so bare with me please. I've been trying to
figure out what's up with the strange forward refernce errors the
compiler (DMD 2.060) is giving me. Here's a code snippet that's
generating a forward reference error:
public class AliasTestClass(alias func)
{
static assert(__traits(isStaticFunction, func));
}
public class TestClass
{
private AliasTestClass!(randomFunction) test; // <-----
public static void randomFunction()
{
}
}
The strange part about it is that if I surround the randomFunction
parameter with another pair of paranthesis like so
private AliasTestClass!((randomFunction)) test;
It works just fine. If I don't, however, I get a forward reference error:
"Error: template instance main.AliasTestClass!(randomFunction) forward
reference of randomFunction"
Am I doing anything wrong or is this some kind of bug?
It's a bug. Maybe it's already in Bugzilla (there are some forward-ref
bugs there already). Please file:
http://d.puremagic.com/issues/enter_bug.cgi
--
Simen
Oct 14 2012
On Sunday, 14 October 2012 at 12:58:24 UTC, Simen Kjaeraas wrote:On 2012-10-14, 14:28, Martin wrote:Oh, thank you for clarifying, I thought I was doing something wrong :)Hey everyone, I'm new to D so bare with me please. I've been trying to figure out what's up with the strange forward refernce errors the compiler (DMD 2.060) is giving me. Here's a code snippet that's generating a forward reference error: public class AliasTestClass(alias func) { static assert(__traits(isStaticFunction, func)); } public class TestClass { private AliasTestClass!(randomFunction) test; // <----- public static void randomFunction() { } } The strange part about it is that if I surround the randomFunction parameter with another pair of paranthesis like so private AliasTestClass!((randomFunction)) test; It works just fine. If I don't, however, I get a forward reference error: "Error: template instance main.AliasTestClass!(randomFunction) forward reference of randomFunction" Am I doing anything wrong or is this some kind of bug?It's a bug. Maybe it's already in Bugzilla (there are some forward-ref bugs there already). Please file: http://d.puremagic.com/issues/enter_bug.cgi
Oct 14 2012








"Martin" <martinbbjerregaard gmail.com>