Bugzilla – Attachment 27 Details for
Bug 36
Templates declared in functions have wrong scope
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Bug creation and email sending has been disabled, file new bugs at
gcc.gnu.org/bugzilla
[patch]
Proposed partial patch
fix-scope-partial.patch (text/plain), 1.41 KB, created by
Johannes Pfau
on 2013-01-19 12:23:34 CET
(
hide
)
Description:
Proposed partial patch
Filename:
MIME Type:
Creator:
Johannes Pfau
Created:
2013-01-19 12:23:34 CET
Size:
1.41 KB
patch
obsolete
>diff --git a/gcc/d/d-glue.cc b/gcc/d/d-glue.cc >index 71c85e7..7693bfa 100644 >--- a/gcc/d/d-glue.cc >+++ b/gcc/d/d-glue.cc >@@ -2674,6 +2674,20 @@ FuncDeclaration::toObjFile (int) > irs->emitLocalVar (v_arguments_var, true); > > 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); >+ } >+ } >+ } > > // Process all deferred nested functions. > for (size_t i = 0; i < this_sym->deferredNestedFuncs.dim; ++i) >@@ -2820,7 +2834,17 @@ Module::genobjfile (int multiobj) > for (size_t i = 0; i < members->dim; i++) > { > Dsymbol *dsym = (*members)[i]; >- dsym->toObjFile (multiobj); >+ //TemplateInstances in functions are emitted from that function >+ if(!dsym->isTemplateInstance() || !dsym->parent || !dsym->parent->isFuncDeclaration()) >+ dsym->toObjFile (multiobj); >+ } >+ >+ //It's possible that we didn't catch all TemplateInstances in functions >+ for (size_t i = 0; i < members->dim; i++) >+ { >+ Dsymbol *dsym = (*members)[i]; >+ if(dsym->isTemplateInstance() && dsym->parent && dsym->parent->isFuncDeclaration()) >+ dsym->toObjFile (multiobj); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 36
: 27 |
28
|
29
|
30
|
31
|
32