Skip to content

Commit ea58b91

Browse files
committed
Properly set up scope prefix instead of hacking it away
1 parent 5550ae5 commit ea58b91

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/cpp/cpp_instantiate_template.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const symbolt &cpp_typecheckt::class_template_symbol(
173173
template_scope!=nullptr, nullptr_exceptiont, "template_scope is null");
174174

175175
irep_idt identifier=
176-
id2string(template_scope->prefix)+
176+
id2string(template_scope->get_parent().prefix)+
177177
"tag-"+id2string(template_symbol.base_name)+
178178
id2string(suffix);
179179

@@ -212,7 +212,7 @@ const symbolt &cpp_typecheckt::class_template_symbol(
212212

213213
id.id_class=cpp_idt::id_classt::CLASS;
214214
id.is_scope=true;
215-
id.prefix=template_scope->prefix+
215+
id.prefix=template_scope->get_parent().prefix+
216216
id2string(s_ptr->base_name)+
217217
id2string(suffix)+"::";
218218
id.class_identifier=s_ptr->name;

src/cpp/cpp_typecheck_template.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,7 @@ cpp_scopet &cpp_typecheckt::typecheck_template_parameters(
729729

730730
// produce a new scope for the template parameters
731731
cpp_scopet &template_scope=
732-
cpp_scopes.current_scope().new_scope(
733-
cpp_scopes.current_scope().prefix+id_suffix);
734-
735-
template_scope.prefix=template_scope.get_parent().prefix+id_suffix;
732+
cpp_scopes.current_scope().new_scope(id_suffix);
736733
template_scope.id_class=cpp_idt::id_classt::TEMPLATE_SCOPE;
737734

738735
cpp_scopes.go_to(template_scope);
@@ -843,9 +840,6 @@ cpp_scopet &cpp_typecheckt::typecheck_template_parameters(
843840
#endif
844841
}
845842

846-
// continue without adding to the prefix
847-
template_scope.prefix=template_scope.get_parent().prefix;
848-
849843
return template_scope;
850844
}
851845

0 commit comments

Comments
 (0)