Skip to content

Commit

Permalink
Fixing build errors on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
shin1m committed Jun 10, 2023
1 parent 7ae6e24 commit fc808d6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/xemmai/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class t_engine
friend class t_symbol;
friend struct t_code;
friend struct t_safe_region;
friend XEMMAI__PORTABLE__EXPORT t_engine* f_engine();
friend t_engine* f_engine();

public:
struct t_options
Expand Down
6 changes: 4 additions & 2 deletions include/xemmai/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class t_global : public t_library
{
friend struct t_type_of<t_map>;
friend class t_engine;
friend XEMMAI__PORTABLE__EXPORT t_global* f_global();
friend t_global* f_global();

static inline XEMMAI__PORTABLE__THREAD t_global* v_instance;

Expand Down Expand Up @@ -235,7 +235,9 @@ XEMMAI__LIBRARY__TYPE(t_global, bytes)
XEMMAI__LIBRARY__TYPE_AS(t_global, t_lexer::t_error, lexer__error)
XEMMAI__LIBRARY__TYPE_AS(t_global, t_parser::t_error, parser__error)

#ifndef _WIN32
#ifdef _WIN32
XEMMAI__PORTABLE__EXPORT t_global* f_global();
#else
inline t_global* f_global()
{
return t_global::v_instance;
Expand Down
4 changes: 2 additions & 2 deletions include/xemmai/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ void f_throw_type_error [[noreturn]] (const wchar_t* a_name)
f_throw_type_error(typeid(typename t_fundamental<T>::t_type), a_name);
}

template<typename T>
inline void f_check(const t_value<auto>& a_object, const wchar_t* a_name)
template<typename T, typename T_tag>
inline void f_check(const t_value<T_tag>& a_object, const wchar_t* a_name)
{
if (!f_is<T>(a_object)) [[unlikely]] f_throw_type_error<T>(a_name);
}
Expand Down
8 changes: 5 additions & 3 deletions include/xemmai/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class t_value : public T_tag
double v_float;
};

void f_copy(const t_value<auto>& a_value)
void f_copy(const auto& a_value)
{
if (sizeof(double) > sizeof(intptr_t))
v_float = a_value.v_float;
Expand All @@ -273,7 +273,8 @@ class t_value : public T_tag
{
f_copy(a_value);
}
t_value(const t_value<auto>& a_value) : T_tag(a_value)
template<typename T>
t_value(const t_value<T>& a_value) : T_tag(a_value)
{
f_copy(a_value);
}
Expand All @@ -284,7 +285,8 @@ class t_value : public T_tag
f_copy(a_value);
return *this;
}
t_value& operator=(const t_value<auto>& a_value)
template<typename T>
t_value& operator=(const t_value<T>& a_value)
{
static_cast<T_tag&>(*this) = a_value;
f_copy(a_value);
Expand Down

0 comments on commit fc808d6

Please sign in to comment.