[Issue 16410] attribute inference inside templated classes

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


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #7 from Steven Schveighoffer <schveiguy at yahoo.com> ---
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.

--


More information about the Digitalmars-d-bugs mailing list