git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: use 'int' for any::array indices
commitfe64592ed088f84623828c19998ff2980b10e3f1 authorAndy Arvanitis <andyarvanitis@gmail.com> dateTue 7 Mar 2017, 19:56 (10 years ago) parentb36e9fe
2 files changed+3−2
pcc/runtime/purescript.cc+2−1 pcc/runtime/purescript.hh+1−1
pcc/runtime/purescript.cc+2−1
@@ -104,7 +104,8 @@ auto any::unthunkVariant(const any& a) -> const any& {
104104 return *variant;
105105}
106106
107−auto any::operator[](const size_t rhs) const -> const any& {
107+auto any::operator[](const int rhs) const -> const any& {
108+ assert(rhs >= 0);
108109 const auto& xs = static_cast<const array&>(*this);
109110 return xs[rhs];
110111}
pcc/runtime/purescript.hh+1−1
@@ -346,7 +346,7 @@ class any {
346346 return static_cast<T>(rawPointer());
347347 }
348348
349− auto operator[](const size_t) const -> const any&;
349+ auto operator[](const int) const -> const any&;
350350 auto at(const char *) const -> const any&;
351351 auto size() const -> size_t;
352352 auto empty() const -> bool;