Skip to content

Project does not build with clang #6

Description

@per-gron

When building CBAG with clang 9.0.1-12 I get the following error

In file included from external/com_bcanalog_cbag/src/cbag/gdsii/write.cpp:52:
In file included from external/com_bcanalog_cbag/include/cbag/gdsii/write.h:63:
In file included from external/com_bcanalog_cbag/include/cbag/layout/cellview_fwd.h:56:
In file included from external/com_bcanalog_cbag/include/cbag/layout/instance.h:56:
In file included from external/com_bcanalog_cbag/include/cbag/common/param_map.h:51:
external/com_bcanalog_cbag/include/cbag/util/sorted_map.h:85:9: error: no member 'key_compare' in 'cbag::util::sorted_map<std::__cxx11::basic_string<char>, std::variant<long, double, bool, std::__cxx11::basic_string<char>, cbag::time_struct, cbag::binary_t>, std::less<std::__cxx11::basic_string<char> > >'; it has not yet been instantiated
        key_compare key_comp_;
        ^
external/com_bcanalog_cbag/include/cbag/util/sorted_vector.h:77:13: note: in instantiation of member class 'cbag::util::sorted_map<std::__cxx11::basic_string<char>, std::variant<long, double, bool, std::__cxx11::basic_string<char>, cbag::time_struct, cbag::binary_t>, std::less<std::__cxx11::basic_string<char> > >::value_compare' requested here
    Compare comp_;
            ^
external/com_bcanalog_cbag/include/cbag/util/sorted_map.h:64:32: note: in instantiation of template class 'cbag::util::sorted_vector<std::pair<std::__cxx11::basic_string<char>, std::variant<long, double, bool, std::__cxx11::basic_string<char>, cbag::time_struct, cbag::binary_t> >, cbag::util::sorted_map<std::__cxx11::basic_string<char>, std::variant<long, double, bool, std::__cxx11::basic_string<char>, cbag::time_struct, cbag::binary_t>, std::less<std::__cxx11::basic_string<char> > >::value_compare>' requested here
    using size_type = typename vector_type::size_type;
                               ^
external/com_bcanalog_cbag/include/cbag/layout/instance.h:70:15: note: in instantiation of template class 'cbag::util::sorted_map<std::__cxx11::basic_string<char>, std::variant<long, double, bool, std::__cxx11::basic_string<char>, cbag::time_struct, cbag::binary_t>, std::less<std::__cxx11::basic_string<char> > >' requested here
    param_map params;
              ^
external/com_bcanalog_cbag/include/cbag/util/sorted_map.h:66:11: note: not-yet-instantiated member is declared here
    using key_compare = Compare;
          ^
1 error generated.

The following patch fixes it

diff --git include/cbag/util/sorted_map.h include/cbag/util/sorted_map.h
index 8d41ae6..6b8ef4d 100644
--- include/cbag/util/sorted_map.h
+++ include/cbag/util/sorted_map.h
@@ -60,10 +60,10 @@ template <class Key, class T, class Compare = std::less<Key>> class sorted_map {
     using key_type = Key;
     using mapped_type = T;
     using value_type = std::pair<key_type, mapped_type>;
+    using key_compare = Compare;
     using vector_type = sorted_vector<value_type, value_compare>;
     using size_type = typename vector_type::size_type;
     using difference_type = typename vector_type::difference_type;
-    using key_compare = Compare;
     using reference = value_type &;
     using const_reference = const value_type &;
     using iterator = typename vector_type::iterator;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions