[Issue 16410] attribute inference inside templated classes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 23 07:51:53 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16410

--- Comment #8 from Lodovico Giaretta <lodovico at giaretart.net> ---
(In reply to Steven Schveighoffer from comment #7)
> I thought that templated classes would infer attributes. But thinking about
> this some more, I wonder if that's correct for virtual base functions?
> 
> I can envision this scenario:
> 
> class Foo(T)
> {
>    string bar() { return "hi"; }
> }
> 
> class Bar(T) : Foo!T
> {
>    override string bar() { return super.bar() ~ T.stringof; }
> }
> 
> Should Foo(T).bar be @nogc? It would be inferred that if Foo was a struct.
> But in this case, it is preventing possibly intended behavior.

Sorry, I don't understand why Foo!T.bar being @nogc would prevent possibly
intended behaviour. Can you please elaborate on this?

--


More information about the Digitalmars-d-bugs mailing list