yaml-cpp
RAD Studio 2010 でコンパイルできません。nodeutil.h
template <typename T, typename U>
struct is_same_type {
enum { value = false };
};
template <typename T>
struct is_same_type<T, T> {
enum { value = true };
};
template <typename T, bool check>
struct is_index_type_with_check {
enum { value = false };
};
template <> struct is_index_type_with_check<std::size_t, false>
{ enum { value = true }; }; // line 24
#define MAKE_INDEX_TYPE(Type) \
template <> struct is_index_type_with_check<Type, is_same_type<Type, std::size_t>::value> { enum { value = true }; }
MAKE_INDEX_TYPE(int);
MAKE_INDEX_TYPE(unsigned); // line 30
MAKE_INDEX_TYPE(short);
MAKE_INDEX_TYPE(unsigned short);
MAKE_INDEX_TYPE(long);
MAKE_INDEX_TYPE(unsigned long);
#undef MAKE_INDEX_TYPE
コンパイラ印刷:
[BCC32 Error] nodeutil.h(30): E2238 Multiple declaration for 'is_index_type_with_check<unsigned int,0>'
[BCC32 Error] nodeutil.h(24): E2344 Earlier declaration of 'is_index_type_with_check<unsigned int,0>'
私はすべて正しいと思います-24行目で私は得ました
is_index_type_with_check<std::size_t, false>
、
30行目で得た
is_index_type_with_check<unsigned, true>
.
2 つの異なるタイプ。
しかし、以下のように 24 行目を変更すると、RAD Studio はコンパイルできます。yaml-cpp
template <> struct is_index_type_with_check<std::size_t, true> { enum { value = true }; }; // false -> true
どうして?!24行目で得た
is_index_type_with_check<std::size_t, true>
そして30行目
is_index_type_with_check<unsigned, true>
2 つの同じタイプ。ただし、すべて RAD Studio で機能し、MS VS 2008 Express では機能しません。