D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12064 - std.typecons.wrap doesn't handle NVI
Summary: std.typecons.wrap doesn't handle NVI
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2014-02-02 09:26 UTC by Matthew Dudley
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Matthew Dudley 2014-02-02 09:26:38 UTC
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.
Comment 1 basile-z 2017-11-13 02:00:24 UTC
PR https://github.com/dlang/phobos/pull/5858
Comment 2 basile-z 2017-11-13 12:51:50 UTC
This was actually a bug that prevented certain case of wrap to compile.
Comment 3 github-bugzilla 2017-11-14 16:01:46 UTC
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/c9f2158b59a460350e993a2deccad9dbcafc7a51
fix issue 12064 - std.typecons.wrap doesn't handle NVI

https://github.com/dlang/phobos/commit/d1a0a32e7997a15b646bfff81e1514458ae6cf1f
Merge pull request #5858 from BBasile/issue-12064

fix issue 12064 - std.typecons.wrap doesn't handle NVI
merged-on-behalf-of: MetaLang <MetaLang@users.noreply.github.com>
Comment 4 github-bugzilla 2017-12-18 22:56:51 UTC
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/c9f2158b59a460350e993a2deccad9dbcafc7a51
fix issue 12064 - std.typecons.wrap doesn't handle NVI

https://github.com/dlang/phobos/commit/d1a0a32e7997a15b646bfff81e1514458ae6cf1f
Merge pull request #5858 from BBasile/issue-12064