Bug 17145 – [REG2.066.0] Tuple expansion error in local enum declaration

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-02-04T12:02:28Z
Last change time
2020-02-09T23:16:37Z
Keywords
CTFE, pull, rejects-valid
Assigned to
No Owner
Creator
Adrian Matoga
See also
https://issues.dlang.org/show_bug.cgi?id=11201, https://issues.dlang.org/show_bug.cgi?id=14595

Comments

Comment #0 by adrian — 2017-02-04T12:02:28Z
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
This seems to be a regression. Introduced in https://github.com/dlang/dmd/pull/3672
Comment #2 by bugzilla — 2018-12-16T10:50:18Z
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