Skip to content

Commit 0ef020e

Browse files
Fixed 2 compiler warnings emitted from ./bootstrap.sh --cxx=g++
One complaining that the order in which == operators were declared was undefined, so making all four equals operations in the value_ref class depend on a single one was fragile and another that enums need to be explicitly static_casted since direct adding between two different enum types is deprecated, now the only warning is about calling free on a heap object in a yyparse function, which from a cursory glance is the compiler not realizing that it only gets freed if it isn't a heap object (#600)
1 parent 50f8535 commit 0ef020e

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/engine/bindjam.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ struct jam_arg_spec_count_sum<X, A...>
560560
// = X::count + jam_arg_spec_count_sum<A...>::value;
561561
enum : std::size_t
562562
{
563-
value = X::count + jam_arg_spec_count_sum<A...>::value
563+
value = static_cast<std::size_t>(X::count) + static_cast<std::size_t>(jam_arg_spec_count_sum<A...>::value)
564564
};
565565
};
566566

src/engine/value.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,15 @@ struct value_ref
131131
inline bool operator==(value_ptr b) const { return val->equal_to(*b); }
132132
inline bool operator==(const char * v) const
133133
{
134-
return (*this) == value_ref(v);
134+
return val->equal_to(*value_ref(v));
135135
}
136-
template <typename T>
137-
inline bool operator!=(T v) const
136+
inline bool operator!=(value_ptr b) const
137+
{
138+
return !(val->equal_to(*b));
139+
}
140+
inline bool operator!=(const char * v) const
138141
{
139-
return !((*this) == v);
142+
return !(val->equal_to(*value_ref(v)));
140143
}
141144
inline value_ptr operator->() const { return val; }
142145
inline value & operator*() const { return *val; }

0 commit comments

Comments
 (0)