[Issue 12064] New: std.typecons.wrap doesn't handle NVI

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 2 09:26:40 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12064

           Summary: std.typecons.wrap doesn't handle NVI
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: pontifechs at gmail.com


--- Comment #0 from Matthew Dudley <pontifechs at gmail.com> 2014-02-02 09:26:38 PST ---
Here's an example:



import std.typecons; //wrap

import std.stdio;


interface FooBar
{
public:
    void foo();
    void bar();

    final void both() // NVI
        {
            foo();
            bar();
        }
}

class Baz
{
public:
    void foo() { writeln("foo"); }
    void bar() { writeln("bar"); }
}

void main()
{
    auto baz = new Baz();
    auto foobar = baz.wrap!(FooBar)();
    // causes this wall-o-text error -- http://pastebin.com/Pa5dHQtN
    // Which at the end says:

    // /usr/local/Cellar/dmd/2.064.2/import/std/typecons.d(2779): 
Error: static assert  "Source Baz does not have structural 
conformance to (FooBar)"
}


It looks like wrap is trying to override the NVI method, but since it's final,
it doesn't work.

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


More information about the Digitalmars-d-bugs mailing list