import std.typecons : tuple;
enum foo = tuple(1, 2).expand; // Compiles up to 2.071.2 and with PR #6517
pragma(msg, typeof(foo).stringof);
pragma(msg, foo.stringof);
void bar()
{
auto roo = tuple(1, 2).expand; // OK
pragma(msg, typeof(roo).stringof);
pragma(msg, roo.stringof);
}
void baz()
{
enum zoo = tuple(1, 2).expand; // Error: value of __tup1847 is not known at compile time
pragma(msg, typeof(zoo).stringof);
pragma(msg, zoo.stringof);
}
Comment #1 by dlang-bugzilla — 2017-07-02T01:57:02Z
Would be nice to have a test case that doesn't rely on Phobos?
Comment #3 by simen.kjaras — 2018-12-17T09:36:40Z
This compiles from 2.064 to 2.071.2, and again from 2.073.2:
auto tuple(T...)(T t) {
struct Result {
T expand;
}
return Result(t);
}
enum foo = tuple(1, 2).expand;
pragma(msg, typeof(foo).stringof);
pragma(msg, foo.stringof);
void bar()
{
auto roo = tuple(1, 2).expand; // OK
pragma(msg, typeof(roo).stringof);
pragma(msg, roo.stringof);
}
This compiles from 2.064 to 2.065.0, but fails ever since:
auto tuple(T...)(T t) {
struct Result {
T expand;
}
return Result(t);
}
void baz()
{
enum zoo = tuple(1, 2).expand; // Error: value of __tup1847 is not known at compile time
pragma(msg, typeof(zoo).stringof);
pragma(msg, zoo.stringof);
}
Comment #4 by dlang-bot — 2020-02-09T09:21:09Z
@WalterBright created dlang/dmd pull request #10774 "fix Issue 17145 - [REG2.066.0] Tuple expansion error in local enum de…" fixing this issue:
- fix Issue 17145 - [REG2.066.0] Tuple expansion error in local enum declaration
https://github.com/dlang/dmd/pull/10774
Comment #5 by dlang-bot — 2020-02-09T23:16:37Z
dlang/dmd pull request #10774 "fix Issue 17145 - [REG2.066.0] Tuple expansion error in local enum de…" was merged into master:
- e1a04df28118fe1e7cf47dde26e1f896630e585a by Walter Bright:
fix Issue 17145 - [REG2.066.0] Tuple expansion error in local enum declaration
https://github.com/dlang/dmd/pull/10774