Skip to content

Commit

Permalink
Fixed some failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo Prötel committed Feb 24, 2024
1 parent 2a0a120 commit b9e9664
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 82 deletions.
1 change: 1 addition & 0 deletions include/cpp2util.h
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ class owning_reference {
owning_reference& operator=(owning_reference&& ref) noexcept = default;
typename std::add_lvalue_reference<T>::type operator*() const { return *assert_not_null(_ptr.get()); }
typename std::add_lvalue_reference<T>::type operator->() const noexcept {return *assert_not_null(_ptr.get());}
auto get() const noexcept { return _ptr.get();}
private:
std::unique_ptr<T> _ptr;
};
Expand Down
2 changes: 1 addition & 1 deletion regression-tests/mixed-type-safety-1.cpp2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ main: () -> int =
print( "1 is int? ", 1 is int );

c := new<Circle>(); // safe by construction
s : * Shape = c.get(); // safe by Lifetime
s : * Shape = c*.get(); // safe by Lifetime
print("\ns* is Shape? ", s* is Shape );
print( "s* is Circle? ", s* is Circle );
print( "s* is Square? ", s* is Square );
Expand Down
Loading

0 comments on commit b9e9664

Please sign in to comment.