1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fix rb_define_global_function to take const VALUE*

It was unable for rb_define_global_function to take VALUE(*)(int argc,
const VLAUE *argv, VALUE self) -style function.  Test added.
This commit is contained in:
卜部昌平 2020-01-28 17:20:16 +09:00
parent bbe3420cce
commit 83d6487ae5
2 changed files with 71 additions and 1 deletions

View file

@ -574,7 +574,7 @@ struct driver0 {
template<bool b> struct specific< 0, b> : public engine< 0, VALUE(*)(VALUE)> {};
template<bool b> struct specific<-1, b> : public engine<-1, VALUE(*)(int argc, VALUE *argv, VALUE self)> {
using engine<-1, VALUE(*)(int argc, VALUE *argv, VALUE self)>::define;
static inline void define(T m, VALUE(*f)(int argc, const VALUE *argv, VALUE self, VALUE)) { F(m, reinterpret_cast<type *>(f), -1); }
static inline void define(T m, VALUE(*f)(int argc, const VALUE *argv, VALUE self)) { F(m, reinterpret_cast<type *>(f), -1); }
};
template<bool b> struct specific<-2, b> : public engine<-2, VALUE(*)(VALUE, VALUE)> {};
/// @endcond