On Wednesday, 12 December 2018 at 16:33:02 UTC, H. S. Teoh wrote:
On Wed, Dec 12, 2018 at 01:35:00PM +, AlCaponeJr via
Digitalmars-d-learn wrote:
On Tuesday, 11 December 2018 at 21:17:46 UTC, H. S. Teoh wrote:
> Whoa. That looks like a compiler bug. File a bug here:
> ...
Genuinely asking
On 12/12/18 10:22 AM, Kagamin wrote:
On Tuesday, 11 December 2018 at 21:19:59 UTC, Steven Schveighoffer wrote:
If I add an int using a regular declaration or a straight mixin("int
i0 = 5;"); then the variable shows up.
mixin template genInts()
{
enum arr = [0];
static foreach (t;
On Wed, Dec 12, 2018 at 01:35:00PM +, AlCaponeJr via Digitalmars-d-learn
wrote:
> On Tuesday, 11 December 2018 at 21:17:46 UTC, H. S. Teoh wrote:
> > Whoa. That looks like a compiler bug. File a bug here:
> > ...
>
> Genuinely asking if this is a case of lacking of unit test for the
>
On Tuesday, 11 December 2018 at 21:19:59 UTC, Steven
Schveighoffer wrote:
If I add an int using a regular declaration or a straight
mixin("int i0 = 5;"); then the variable shows up.
mixin template genInts()
{
enum arr = [0];
static foreach (t; arr)
{
mixin("int i0 = 5;");
On Tuesday, 11 December 2018 at 21:17:46 UTC, H. S. Teoh wrote:
Whoa. That looks like a compiler bug. File a bug here:
...
Genuinely asking if this is a case of lacking of unit test for
the Compiler or this is a case that where is hard to test or
prevent?
Al.
On Tuesday, 11 December 2018 at 21:09:55 UTC, Johannes Riecken
wrote:
Code:
import std.conv;
import std.stdio;
mixin template genInts()
{
enum arr = [0,1];
static foreach (t; arr) {
mixin("int i" ~ to!string(t) ~ " = 5;");
}
}
void main() {
mixin genInts!();
writeln(i0);
P.S. Just looked at the disassembly. Seems to be a codegen bug -- the
code appears to be trying to lookup local variables (presumably i0 and
i1), but somehow the initialization code is missing.
--T
On Tue, Dec 11, 2018 at 09:09:55PM +, Johannes Riecken via
Digitalmars-d-learn wrote:
>
On 12/11/18 4:09 PM, Johannes Riecken wrote:
Code:
import std.conv;
import std.stdio;
mixin template genInts()
{
enum arr = [0,1];
static foreach (t; arr) {
mixin("int i" ~ to!string(t) ~ " = 5;");
}
}
void main() {
mixin genInts!();
writeln(i0);
writeln(i1);
}
On Tue, Dec 11, 2018 at 09:09:55PM +, Johannes Riecken via
Digitalmars-d-learn wrote:
> Code:
>
> import std.conv;
> import std.stdio;
>
> mixin template genInts()
> {
> enum arr = [0,1];
> static foreach (t; arr) {
> mixin("int i" ~ to!string(t) ~ " = 5;");
> }
> }
>
> void
Code:
import std.conv;
import std.stdio;
mixin template genInts()
{
enum arr = [0,1];
static foreach (t; arr) {
mixin("int i" ~ to!string(t) ~ " = 5;");
}
}
void main() {
mixin genInts!();
writeln(i0);
writeln(i1);
}
Expected output:
5
5
Actual output is two garbage integer
10 matches
Mail list logo