Allow duplicate definitions of templates
This commit is contained in:
parent
47a643e113
commit
019163b585
1 changed files with 5 additions and 4 deletions
|
|
@ -26,8 +26,9 @@ void cpp_entity_index::register_definition(cpp_entity_id
|
||||||
{
|
{
|
||||||
// already in map, override declaration
|
// already in map, override declaration
|
||||||
auto& value = result.first->second;
|
auto& value = result.first->second;
|
||||||
if (value.is_definition && !is_template_specialization(value.entity->kind()))
|
if (value.is_definition && !is_template(value.entity->kind()))
|
||||||
// allow duplicate definition of template specializations as a workaround for MacOS
|
// allow duplicate definition of templates
|
||||||
|
// this handles things such as SFINAE
|
||||||
throw duplicate_definition_error();
|
throw duplicate_definition_error();
|
||||||
value.is_definition = true;
|
value.is_definition = true;
|
||||||
value.entity = entity;
|
value.entity = entity;
|
||||||
|
|
@ -55,8 +56,8 @@ void cpp_entity_index::register_namespace(cpp_entity_id
|
||||||
ns_[std::move(id)].push_back(ns);
|
ns_[std::move(id)].push_back(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
type_safe::optional_ref<const cpp_entity> cpp_entity_index::lookup(const cpp_entity_id& id) const
|
type_safe::optional_ref<const cpp_entity> cpp_entity_index::lookup(
|
||||||
noexcept
|
const cpp_entity_id& id) const noexcept
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
auto iter = map_.find(id);
|
auto iter = map_.find(id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue