On Monday, 30 January 2017 at 12:40:44 UTC, Jack Applegame wrote:
bug report: https://issues.dlang.org/show_bug.cgi?id=17128
LDC (2.070.2) has a different problem: the dtor is never called.
bug report: https://issues.dlang.org/show_bug.cgi?id=17128
On 01/30/2017 12:55 PM, Jack Applegame wrote:
Code:
import std.stdio;
struct Foo {
int val = 0;
~this() {
writefln("destruct %s", val);
}
}
void bar(ARGS...)() {
ARGS args;
args[0].val = 1;
writefln("val = %s", args[0].val);
}
void main() {
bar!Foo();
}
WORKAROUND:
import std.stdio;
struct Foo {
int val = 0;
~this() {
writefln("destruct %s", val);
}
}
void bar(ARGS...)() {
struct Tuple {
ARGS args;
alias args this;
}
Tuple args;
args[0].val = 1;
writefln("val = %s", args[0].val);
}
Code:
import std.stdio;
struct Foo {
int val = 0;
~this() {
writefln("destruct %s", val);
}
}
void bar(ARGS...)() {
ARGS args;
args[0].val = 1;
writefln("val = %s", args[0].val);
}
void main() {
bar!Foo();
}
Excpected output:
val = 1
destruct 1
But
module test;
public interface I
{
void foo();
void foo(int);
}
public abstract class A : I
{
public void bar()
{
foo();
}
public void foo(int i)
{
}
}
public class C : A
{
public void foo()
{
}
public void bar2()
{
foo(1);
On Sat, 26 Apr 2014 06:55:38 +
Domain via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
module test;
public interface I
{
void foo();
void foo(int);
}
public abstract class A : I
{
public void bar()
{
foo();
}
public
On 4/26/14, Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
No. That's expected.
I wonder whether a better diagnostic could help. But then again, maybe
the hiding would be intentional and the diagnostic would be
spurious/invalid. Not sure..
I'm trying to learn template meta programming in D. To do this, I'm working
on a meta state machine like Boost.MSM
(http://www.boost.org/doc/libs/1_47_0/libs/msm/doc/HTML/index.html).
States are types and can have sub states. If they do, they need to have
an attribut 'SubStates', which should