People really should never, ever, ever use libarchive internal headers. And they definitely should not expect libarchive internal headers to work in a C++ compiler. (C++ and C are really just not that compatible.)
However, people do a lot of things they shouldn't: Avoid the reserved C++ keyword `template`
void __archive_ensure_cloexec_flag(int fd);
int __archive_mktemp(const char *tmpdir);
#if defined(_WIN32) && !defined(__CYGWIN__)
-int __archive_mkstemp(wchar_t *template);
+int __archive_mkstemp(wchar_t *templates);
#else
-int __archive_mkstemp(char *template);
+int __archive_mkstemp(char *templates);
#endif
int __archive_clean(struct archive *);