Skip to content

Commit 019163b

Browse files
committed
Allow duplicate definitions of templates
1 parent 47a643e commit 019163b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/cpp_entity_index.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ void cpp_entity_index::register_definition(cpp_entity_id
2626
{
2727
// already in map, override declaration
2828
auto& value = result.first->second;
29-
if (value.is_definition && !is_template_specialization(value.entity->kind()))
30-
// allow duplicate definition of template specializations as a workaround for MacOS
29+
if (value.is_definition && !is_template(value.entity->kind()))
30+
// allow duplicate definition of templates
31+
// this handles things such as SFINAE
3132
throw duplicate_definition_error();
3233
value.is_definition = true;
3334
value.entity = entity;
@@ -55,8 +56,8 @@ void cpp_entity_index::register_namespace(cpp_entity_id
5556
ns_[std::move(id)].push_back(ns);
5657
}
5758

58-
type_safe::optional_ref<const cpp_entity> cpp_entity_index::lookup(const cpp_entity_id& id) const
59-
noexcept
59+
type_safe::optional_ref<const cpp_entity> cpp_entity_index::lookup(
60+
const cpp_entity_id& id) const noexcept
6061
{
6162
std::lock_guard<std::mutex> lock(mutex_);
6263
auto iter = map_.find(id);

0 commit comments

Comments
 (0)