Skip to content

Commit

Permalink
Bugfix for nonconst has in generated flag_enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxSagebaum committed May 15, 2024
1 parent 001a1a1 commit 2ce8e9f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions regression-tests/test-results/pure2-enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public: constexpr auto operator^=(file_attributes const& that) & -> void;
public: [[nodiscard]] constexpr auto operator|(file_attributes const& that) const& -> file_attributes;
public: [[nodiscard]] constexpr auto operator&(file_attributes const& that) const& -> file_attributes;
public: [[nodiscard]] constexpr auto operator^(file_attributes const& that) const& -> file_attributes;
public: [[nodiscard]] constexpr auto has(file_attributes const& that) & -> bool;
public: [[nodiscard]] constexpr auto has(file_attributes const& that) const& -> bool;
public: constexpr auto set(file_attributes const& that) & -> void;
public: constexpr auto clear(file_attributes const& that) & -> void;
public: static const file_attributes cached;
Expand Down Expand Up @@ -202,7 +202,7 @@ constexpr auto file_attributes::operator^=(file_attributes const& that) & -> voi
[[nodiscard]] constexpr auto file_attributes::operator|(file_attributes const& that) const& -> file_attributes { return _value | that._value; }
[[nodiscard]] constexpr auto file_attributes::operator&(file_attributes const& that) const& -> file_attributes { return _value & that._value; }
[[nodiscard]] constexpr auto file_attributes::operator^(file_attributes const& that) const& -> file_attributes { return _value ^ that._value; }
[[nodiscard]] constexpr auto file_attributes::has(file_attributes const& that) & -> bool { return _value & that._value; }
[[nodiscard]] constexpr auto file_attributes::has(file_attributes const& that) const& -> bool { return _value & that._value; }
constexpr auto file_attributes::set(file_attributes const& that) & -> void { _value |= that._value; }
constexpr auto file_attributes::clear(file_attributes const& that) & -> void { _value &= ~that._value; }
inline CPP2_CONSTEXPR file_attributes file_attributes::cached = 1;
Expand Down
2 changes: 1 addition & 1 deletion source/reflect.h
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ std::string value{"-1"};
CPP2_UFCS(add_member)(t, (" operator| : ( this, that ) -> " + cpp2::to_string(CPP2_UFCS(name)(t)) + " == _value | that._value;"));
CPP2_UFCS(add_member)(t, (" operator& : ( this, that ) -> " + cpp2::to_string(CPP2_UFCS(name)(t)) + " == _value & that._value;"));
CPP2_UFCS(add_member)(t, (" operator^ : ( this, that ) -> " + cpp2::to_string(CPP2_UFCS(name)(t)) + " == _value ^ that._value;"));
CPP2_UFCS(add_member)(t, " has : ( inout this, that ) -> bool == _value & that._value;");
CPP2_UFCS(add_member)(t, " has : ( this, that ) -> bool == _value & that._value;");
CPP2_UFCS(add_member)(t, " set : ( inout this, that ) == _value |= that._value;");
CPP2_UFCS(add_member)(t, " clear : ( inout this, that ) == _value &= that._value~;");
}
Expand Down
2 changes: 1 addition & 1 deletion source/reflect.h2
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ basic_enum: (
t.add_member( " operator| : ( this, that ) -> (t.name())$ == _value | that._value;");
t.add_member( " operator& : ( this, that ) -> (t.name())$ == _value & that._value;");
t.add_member( " operator^ : ( this, that ) -> (t.name())$ == _value ^ that._value;");
t.add_member( " has : ( inout this, that ) -> bool == _value & that._value;");
t.add_member( " has : ( this, that ) -> bool == _value & that._value;");
t.add_member( " set : ( inout this, that ) == _value |= that._value;");
t.add_member( " clear : ( inout this, that ) == _value &= that._value~;");
}
Expand Down

0 comments on commit 2ce8e9f

Please sign in to comment.