Comment #2 by andrej.mitrovich — 2012-09-21T08:25:16Z
What exact rules does the language define for these function-nested types? It seems arbitrary that some things are allowed while others are not, for example this works:
void check(T)()
{
T t = T.init;
t.foo();
}
void main()
{
struct S
{
int n;
void foo(){}
}
check!S();
}
Comment #3 by yebblies — 2013-11-24T06:03:57Z
The pull request wasn't merged, but both cases now error.
Comment #4 by k.hara.pg — 2014-04-11T12:14:25Z
(In reply to yebblies from comment #3)
> The pull request wasn't merged, but both cases now error.
The opening test case still does not cause front-end errors (no error occur with -o- switch).
And T t; should also be rejected if T is nested struct. Updated test case is:
void check(T)()
{
// nested struct constructions outside valid frame scope
T t0; // new!
T t1 = T();
T t2 = T(1);
}
void main()
{
struct S
{
int n;
void foo(){}
}
check!S();
}
(In reply to Kenji Hara from comment #1)
> https://github.com/D-Programming-Language/dmd/pull/1133
I reopened the pull request to fix this issue perfectly.
Comment #5 by k.hara.pg — 2014-04-11T12:18:35Z
*** Issue 5902 has been marked as a duplicate of this issue. ***
Comment #6 by github-bugzilla — 2014-05-14T12:11:39Z