Skip to content

Commit 87fddb8

Browse files
committed
Properly set up scope prefix instead of hacking it away
1 parent ab0812c commit 87fddb8

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
@@ -183,7 +183,7 @@ const symbolt &cpp_typecheckt::class_template_symbol(
183183
template_scope!=nullptr, nullptr_exceptiont, "template_scope is null");
184184

185185
irep_idt identifier=
186-
id2string(template_scope->prefix)+
186+
id2string(template_scope->get_parent().prefix)+
187187
"tag-"+id2string(template_symbol.base_name)+
188188
id2string(suffix);
189189

@@ -222,7 +222,7 @@ const symbolt &cpp_typecheckt::class_template_symbol(
222222

223223
id.id_class=cpp_idt::id_classt::CLASS;
224224
id.is_scope=true;
225-
id.prefix=template_scope->prefix+
225+
id.prefix=template_scope->get_parent().prefix+
226226
id2string(s_ptr->base_name)+
227227
id2string(suffix)+"::";
228228
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
@@ -736,10 +736,7 @@ cpp_scopet &cpp_typecheckt::typecheck_template_parameters(
736736

737737
// produce a new scope for the template parameters
738738
cpp_scopet &template_scope=
739-
cpp_scopes.current_scope().new_scope(
740-
cpp_scopes.current_scope().prefix+id_suffix);
741-
742-
template_scope.prefix=template_scope.get_parent().prefix+id_suffix;
739+
cpp_scopes.current_scope().new_scope(id_suffix);
743740
template_scope.id_class=cpp_idt::id_classt::TEMPLATE_SCOPE;
744741

745742
cpp_scopes.go_to(template_scope);
@@ -850,9 +847,6 @@ cpp_scopet &cpp_typecheckt::typecheck_template_parameters(
850847
#endif
851848
}
852849

853-
// continue without adding to the prefix
854-
template_scope.prefix=template_scope.get_parent().prefix;
855-
856850
return template_scope;
857851
}
858852

0 commit comments

Comments
 (0)