| Posted by johanengelen@weka.io | PermalinkReply |
|
johanengelen@weka.io
| https://issues.dlang.org/show_bug.cgi?id=18628
--- Comment #5 from johanengelen@weka.io ---
(In reply to RazvanN from comment #1)
> Well, the struct defines the member, it's just that it is disabled. One might argue that the output is correct and the programmer needs to check if the member is disabled or not
I strongly disagree.
The `@disabled` function line does not _define_ the function (i.e. there is no implementation for it), at most it could be a _declaration_. But in fact, in my opinion, the `@disable` line explicitly says that it's not even declared, similar to C++'s "= delete".
Currently, adding `@disable this(this)` to a struct that normally wouldn't have
a postblit, actually makes the compiler emit a postblit function:
https://d.godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(j:1,lang:___d,source:'struct+S+%7B%0A++++int+i%3B%0A%0A++++@disable+this(this)%3B%0A%7D'),l:'5',n:'0',o:'D+source+%231',t:'0')),k:34.254797922596914,l:'4',m:100,n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:ldc180,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',trim:'0'),lang:___d,libs:!(),options:'-O3',source:1,wantOptInfo:'1'),l:'5',n:'0',o:'ldc+1.8.0+(Editor+%231,+Compiler+%231)+D',t:'0')),k:32.41186874406977,l:'4',m:100,n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:dmd20790,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',trim:'0'),lang:___d,libs:!(),options:'-O',source:1),l:'5',n:'0',o:'dmd+2.079.0+(Editor+%231,+Compiler+%232)+D',t:'0')),k:33.33333333333333,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4
--
|