Bug 5969 – Poor error message for foreach over type tuple
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-05-09T08:19:00Z
Last change time
2015-10-11T11:42:20Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2011-05-09T08:19:38Z
This code fails with a back-end error:
test.d(7): Error: type Foo is not an expression
struct Foo {
int a;
}
int foo()
{
foreach (f; Foo.tupleof)
{}
return 1;
}
//static assert(foo());
It should be a front-end error. If you uncomment the static assert, you get a cryptic "cannot interpret Foo at compile time" error.
But the error should have been detected before CTFE was initiated.
Comment #1 by andrej.mitrovich — 2013-01-19T21:49:39Z