Bug 16025 – mixin myTemplate should throw an error

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-05-14T19:00:44Z
Last change time
2022-12-22T11:21:35Z
Assigned to
No Owner
Creator
Seb

Comments

Comment #0 by greensunny12 — 2016-05-14T19:00:44Z
problem: mixin myTemplate; // silently doesn't work mixin(myTemplate); solution: 1) Throw an error for the silent case 2) allow mixin statements without parenthesis (preferred solution)
Comment #1 by ag0aep6g — 2016-05-14T19:10:05Z
Please provide a full test case. As it is, your code fails because myTemplate isn't defined. When I add `template myTemplate() {}`, then it compiles. That's expected. You may be mixing up template mixins with string mixins. `mixin myTemplate;` is a template mixin. `mixin(myTemplate)` is a string mixin. They do different things.
Comment #2 by b2.temp — 2016-05-15T07:54:22Z
I suppose he speaks about this: ---- mixin template Foo(){} template Bar(){} // not a mixin mixin Foo; mixin Bar; // can be mixed void main(){} ---- a template can be mixed even if it's not a mixin template.
Comment #3 by ag0aep6g — 2016-06-05T11:39:39Z
*** Issue 16125 has been marked as a duplicate of this issue. ***
Comment #4 by ag0aep6g — 2016-06-05T11:41:00Z
See also issue 12298.
Comment #5 by razvan.nitu1305 — 2022-12-22T11:21:35Z
*** This issue has been marked as a duplicate of issue 12298 ***