Skip to content

Commit 166b59e

Browse files
authored
Bugfix for nonconst has in generated flag_enums. (#1070)
1 parent 0e24c9a commit 166b59e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Diff for: regression-tests/test-results/pure2-enum.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public: constexpr auto operator^=(file_attributes const& that) & -> void;
8383
public: [[nodiscard]] constexpr auto operator|(file_attributes const& that) const& -> file_attributes;
8484
public: [[nodiscard]] constexpr auto operator&(file_attributes const& that) const& -> file_attributes;
8585
public: [[nodiscard]] constexpr auto operator^(file_attributes const& that) const& -> file_attributes;
86-
public: [[nodiscard]] constexpr auto has(file_attributes const& that) & -> bool;
86+
public: [[nodiscard]] constexpr auto has(file_attributes const& that) const& -> bool;
8787
public: constexpr auto set(file_attributes const& that) & -> void;
8888
public: constexpr auto clear(file_attributes const& that) & -> void;
8989
public: static const file_attributes cached;
@@ -202,7 +202,7 @@ constexpr auto file_attributes::operator^=(file_attributes const& that) & -> voi
202202
[[nodiscard]] constexpr auto file_attributes::operator|(file_attributes const& that) const& -> file_attributes { return _value | that._value; }
203203
[[nodiscard]] constexpr auto file_attributes::operator&(file_attributes const& that) const& -> file_attributes { return _value & that._value; }
204204
[[nodiscard]] constexpr auto file_attributes::operator^(file_attributes const& that) const& -> file_attributes { return _value ^ that._value; }
205-
[[nodiscard]] constexpr auto file_attributes::has(file_attributes const& that) & -> bool { return _value & that._value; }
205+
[[nodiscard]] constexpr auto file_attributes::has(file_attributes const& that) const& -> bool { return _value & that._value; }
206206
constexpr auto file_attributes::set(file_attributes const& that) & -> void { _value |= that._value; }
207207
constexpr auto file_attributes::clear(file_attributes const& that) & -> void { _value &= ~that._value; }
208208
inline CPP2_CONSTEXPR file_attributes file_attributes::cached = 1;

Diff for: source/reflect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ std::string value{"-1"};
17411741
CPP2_UFCS(add_member)(t, (" operator| : ( this, that ) -> " + cpp2::to_string(CPP2_UFCS(name)(t)) + " == _value | that._value;"));
17421742
CPP2_UFCS(add_member)(t, (" operator& : ( this, that ) -> " + cpp2::to_string(CPP2_UFCS(name)(t)) + " == _value & that._value;"));
17431743
CPP2_UFCS(add_member)(t, (" operator^ : ( this, that ) -> " + cpp2::to_string(CPP2_UFCS(name)(t)) + " == _value ^ that._value;"));
1744-
CPP2_UFCS(add_member)(t, " has : ( inout this, that ) -> bool == _value & that._value;");
1744+
CPP2_UFCS(add_member)(t, " has : ( this, that ) -> bool == _value & that._value;");
17451745
CPP2_UFCS(add_member)(t, " set : ( inout this, that ) == _value |= that._value;");
17461746
CPP2_UFCS(add_member)(t, " clear : ( inout this, that ) == _value &= that._value~;");
17471747
}

Diff for: source/reflect.h2

+1-1
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ basic_enum: (
10981098
t.add_member( " operator| : ( this, that ) -> (t.name())$ == _value | that._value;");
10991099
t.add_member( " operator& : ( this, that ) -> (t.name())$ == _value & that._value;");
11001100
t.add_member( " operator^ : ( this, that ) -> (t.name())$ == _value ^ that._value;");
1101-
t.add_member( " has : ( inout this, that ) -> bool == _value & that._value;");
1101+
t.add_member( " has : ( this, that ) -> bool == _value & that._value;");
11021102
t.add_member( " set : ( inout this, that ) == _value |= that._value;");
11031103
t.add_member( " clear : ( inout this, that ) == _value &= that._value~;");
11041104
}

0 commit comments

Comments
 (0)