Fix compilation with g++ 4.8.5 on el7

G++ 4.8.5 doesn't allow a function template specialization to appear
in a namespace that is different from the namespace where the function
template was declared.  Also, in that namespace, the name of the
specialized function template must be non-fully-qualified.

Fixed thus.

	* include/abg-libxml-utils.h (build_sptr<xmlTextReader>): Wrap
	this specialization in the namespace sptr_utils and do away with
	the sptr_utils qualifier.
	* include/abg-regex.h (build_sptr<regex_t>): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2020-05-04 12:46:30 +02:00
parent 186cc9ed3a
commit f014f8c1f0
2 changed files with 12 additions and 4 deletions

View File

@ -129,14 +129,18 @@ unescape_xml_comment(const std::string& str);
}//end namespace xml
namespace sptr_utils
{
/// Specialization of sptr_utils::build_sptr for xmlTextReader
template<>
xml::reader_sptr
sptr_utils::build_sptr<xmlTextReader>(xmlTextReader *p);
build_sptr<xmlTextReader>(xmlTextReader *p);
/// Specialization of build_str for xmlChar.
template<>
xml::xml_char_sptr sptr_utils::build_sptr<xmlChar>(xmlChar *p);
xml::xml_char_sptr
build_sptr<xmlChar>(xmlChar *p);
}// end namespace sptr_utils
}//end namespace abigail
#endif //__ABG_LIBXML_UTILS_H__

View File

@ -63,6 +63,8 @@ generate_from_strings(const std::vector<std::string>& strs);
}// end namespace regex
namespace sptr_utils
{
/// Specialization of sptr_utils::build_sptr for regex_t.
///
/// This is used to wrap a pointer to regex_t into a
@ -73,7 +75,7 @@ generate_from_strings(const std::vector<std::string>& strs);
/// @return the shared_ptr<regex_t> that wraps @p p.
template<>
regex::regex_t_sptr
sptr_utils::build_sptr<regex_t>(regex_t *p);
build_sptr<regex_t>(regex_t *p);
/// Specialization of sptr_utils::build_sptr for regex_t.
///
@ -82,7 +84,9 @@ sptr_utils::build_sptr<regex_t>(regex_t *p);
/// @return the shared_ptr<regex_t> wrapping the newly created regex_t*
template<>
regex::regex_t_sptr
sptr_utils::build_sptr<regex_t>();
build_sptr<regex_t>();
}// end namespace sptr_utils
}// end namespace abigail