-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"concurrentqueue.h:366:63: error: no template named 'has_trivial_destructor'" #14
Comments
Hmm, that is ugly. An old GCC 4.2 with a modern LLVM backend. I'll have to think about that. |
I fixed it with this: namespace std
{
template<typename> struct has_trivial_destructor;
template<typename> struct is_trivially_destructible;
}
namespace Freebird_cxx11_trait_util
{
template<typename T>
class have_cxx11_trait_helper
{
template<typename T2, bool = std::is_trivially_destructible<T2>::type::value>
static std::true_type test(int);
template<typename T2, bool = std::has_trivial_destructor<T2>::type::value>
static std::false_type test(...);
public:
typedef decltype(test<T>(0)) type;
};
template<typename T>
struct have_cxx11_trait : have_cxx11_trait_helper<T>::type
{ };
}
// ....
template<typename It>
static inline auto deref_noexcept(It& it) MOODYCAMEL_NOEXCEPT -> decltype(*it)
{
return *it;
}
template<typename T>
using is_trivially_destructible
= typename std::conditional<
Freebird_cxx11_trait_util::have_cxx11_trait<T>::value,
std::is_trivially_destructible<T>,
std::has_trivial_destructor<T>
>::type;
#ifdef MOODYCAMEL_CPP11_THREAD_LOCAL_SUPPORTED which can be found on Stackoverflow |
…er GCCs when they use a newer libstdc++ with a modern clang backend (this happens on OS X 10.10.2, for example) (issue #14)
I've committed your original macro-based fix for now (you were right about the condition, by the way, I was mixing up the two lines). I'm not sure how slightly older compilers will react to the template wizardry involved in the second one (somebody commented on that SO question that it's broken on clang 3.1). Thanks for reporting this, and for the fixes! Much appreciated. |
./concurrentqueue.hpp:396:70: error: no template named 'has_trivial_destructor' in namespace 'std'; did you mean 'has_virtual_destructor'? 1 error generated.clang++ --version |
Seems the error came back to haunt us? I'll look into this shortly, thanks for the report. |
Sorry about that. It should be fixed now. Obviously the GCC version detection doesn't work very well with clang because it defines the GCC macros (but isn't bug-for-bug compatible). |
@cameron314 sorry for reopen this issue, there is no necessary to use At first, I use Maybe you can just remove the first #if defined(__clang__) || !defined(__GNUC__) .|| some others It is not a bug, I just think this may seems more beautiful. |
Hmm, yep, makes sense. The gcc on Mac OS X must simply be a wrapper around clang. Thanks for the pull request! |
My pleasure, your code is really useful and make some contribution for this project is also means help myself. |
OS: OSX 10.10.2
ERROR MESSAGE:
Compiler:
Realted Macros :
__GNUC__
: 4__GNUC_MINOR__
: 2__APPLE__
: 1My fix :
line 362: ( https://github.com/cameron314/concurrentqueue/blob/master/concurrentqueue.h#L362 )
It works, but I think it seems too ugly.
The text was updated successfully, but these errors were encountered: