We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following program prints "true" when compiled together, and "false" when compiled separately: --- dub.json { "name": "example" } --- source/app.d import node; void main() { import std.stdio; writeln(__traits(compiles, Struct.init == Struct.init)); } --- source/node.d import example; alias Node = Example!Struct; struct Struct { Node[] nodes; } --- source/example.d struct Example(T) { T t; static if (__traits(compiles, T.init == T.init)) { bool opEquals(Example!T rhs) { return this.t == rhs.t; } } else { @disable bool opEquals(Example!T rhs); } } --- To build and run with dub: $ dub --quiet build --build-mode=singleFile --force && dub --quiet run false $ dub --quiet build --force && dub --quiet run true
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Paul Backus (@pbackus) reported this on 2018-11-20T20:11:02Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=19417
Description
The following program prints "true" when compiled together, and "false" when compiled separately: --- dub.json { "name": "example" } --- source/app.d import node; void main() { import std.stdio; writeln(__traits(compiles, Struct.init == Struct.init)); } --- source/node.d import example; alias Node = Example!Struct; struct Struct { Node[] nodes; } --- source/example.d struct Example(T) { T t; static if (__traits(compiles, T.init == T.init)) { bool opEquals(Example!T rhs) { return this.t == rhs.t; } } else { @disable bool opEquals(Example!T rhs); } } --- To build and run with dub: $ dub --quiet build --build-mode=singleFile --force && dub --quiet run false $ dub --quiet build --force && dub --quiet run trueThe text was updated successfully, but these errors were encountered: