Created attachment 24 [details] test case 1 Test case 1 and 2 basically show the same problem: If we have a template with access to an alias parameter, that alias parameter can be a nested function. So the template and therefore all functions in it have access to the nested function which essentially means those functions have to be treated as if they were nested as well. We currently mark those functions as TREE_PUBLIC which fails a verify check in gcc-4.7 when compiled with --enable-checking. Basic example: (Pseudo-Code) ------- void a()() { int var; void b() { var = 0; } Test!b(); } struct Test(alias t) { void abc() //Marked as public, although calls nested function b { t(); } } ------- Test case 2 shows that we also have to check recursively for parent templates. I'm not sure if this could also somehow affect templates instantiated with nested classes? It seems the frontends hasNestedArgs and isnested members in TemplateDeclaration could be used to check for this. Those frontend functions don't correctly detect the second test case though: http://d.puremagic.com/issues/show_bug.cgi?id=9292 Patch 1 shows how the frontend checking code could be used.
Created attachment 25 [details] test case 2
Created attachment 26 [details] Simple patch
Looks fine to me, though the whitespace looks a bit off. :)
Yes, the patch was only a quick test, it's not ready for merging. It's a little bit annoying that it can't detect complicated cases as the hasNestedArgs check in the frontend doesn't detect those properly...
Fixed https://github.com/D-Programming-GDC/GDC/commit/111c97180ef44b3b3a3ca01afb6dd1267ba35856