← Back to index
|
Original Bugzilla link
Bug 19417 – Separate compilation changes result of __traits(compiles)
Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-11-20T20:11:02Z
Last change time
2024-12-13T19:01:23Z
Assigned to
No Owner
Creator
Paul Backus
Moved to GitHub: dmd#19511 →
Comments
Comment #0
by snarwin+bugzilla — 2018-11-20T20:11:02Z
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
Comment #1
by robert.schadek — 2024-12-13T19:01:23Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/19511
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB