[Issue 8863] struct passed to template: cannot access frame pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 14 00:14:03 PST 2012


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



--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2012-11-14 00:13:59 PST ---
(In reply to comment #2)
> So I'd say it is a bug, and the fault is likely in
> TemplateInstance::hasNestedArgs().

I think that the rule should not be applied to the template type argument, even
if the type is a nested struct.

Let's consider more complicated case.
This code currently compiles successfully.

auto foo() {
    struct X { void f(){} } // nested
    return X();
}
auto bar() {
    struct Y { void g(){} } // nested
    return Y();
}

// import std.typecons;
struct Tuple(T...) {
    T field;
}
Tuple!T tuple(T...)(T args) {
    return typeof(return)(args);
}

void main() {
    auto t = tuple(foo(), bar());
}

In above code, the template struct Tuple is instantiated with X and Y.
If the nested struct type argument make the given template instance nested,
Tuple!(X, Y) should have two context pointers, but the code generation will
fail.

Then the change you say will break much existing code. I think it is not mostly
acceptable.

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


More information about the Digitalmars-d-bugs mailing list