public
Created

  • Download Gist
gistfile1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/gcc/d/d-glue.cc b/gcc/d/d-glue.cc
index 71c85e7..14d7000 100644
--- a/gcc/d/d-glue.cc
+++ b/gcc/d/d-glue.cc
@@ -2675,6 +2675,20 @@ FuncDeclaration::toObjFile (int)
fbody->toIR (irs);
+ // Find all template instances that are nested in this scope and emit
+ Module * module = getModule();
+ if (module->members)
+ {
+ for (size_t i = 0; i < module->members->dim; i++)
+ {
+ Dsymbol *dsym = (*module->members)[i];
+ if(dsym->isTemplateInstance() && dsym->parent == this)
+ {
+ dsym->toObjFile (false); //What should multiobj be?
+ }
+ }
+ }
+
// Process all deferred nested functions.
for (size_t i = 0; i < this_sym->deferredNestedFuncs.dim; ++i)
{
@@ -2820,10 +2835,23 @@ Module::genobjfile (int multiobj)
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *dsym = (*members)[i];
- dsym->toObjFile (multiobj);
+ if(!dsym->isTemplateInstance())
+ {
+ dsym->toObjFile (multiobj);
+ }
}
- }
+ //Defer template instances
+ for (size_t i = 0; i < members->dim; i++)
+ {
+ Dsymbol *dsym = (*members)[i];
+ if(dsym->isTemplateInstance())
+ {
+ dsym->toObjFile (multiobj);
+ }
+ }
+ }
+
// Always generate module info.
if (1 || needModuleInfo())
{

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.