D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6388 - Bad example about Mixin
Summary: Bad example about Mixin
Status: RESOLVED DUPLICATE of issue 1986
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-26 19:52 UTC by Heromyth
Modified: 2011-10-25 08:21 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Heromyth 2011-07-26 19:52:29 UTC
There is an example in http://www.digitalmars.com/d/2.0/mixin.html, like belown:

template GenStruct(char[] Name, char[] M1)
{
    const char[] GenStruct = "struct " ~ Name ~ "{ int " ~ M1 ~ "; }";
}

mixin(GenStruct!("Foo", "bar"));


It can be compiled when using in a demo. The char[] should be changed to string.

By the way, it seems that the mixin can only accept the type of const char[]. Should it take string type?
Comment 1 Kasumi Hanazuki 2011-10-25 08:21:35 UTC

*** This issue has been marked as a duplicate of issue 1986 ***