1. 12 Oct, 2017 2 commits
    • Add informative compilation failure for method_adaptor failures · 7672292e
      When using `method_adaptor` (usually implicitly via a `cl.def("f",
      &D::f)`) a compilation failure results if `f` is actually a method of
      an inaccessible base class made public via `using`, such as:
      
          class B { public: void f() {} };
          class D : private B { public: using B::f; };
      
      pybind deduces `&D::f` as a `B` member function pointer.  Since the base
      class is inaccessible, the cast in `method_adaptor` from a base class
      member function pointer to derived class member function pointer isn't
      valid, and a cast failure results.
      
      This was sort of a regression in 2.2, which introduced `method_adaptor`
      to do the expected thing when the base class *is* accessible.  It wasn't
      actually something that *worked* in 2.1, though: you wouldn't get a
      compile-time failure, but the method was not callable (because the `D *`
      couldn't be cast to a `B *` because of the access restriction).  As a
      result, you'd simply get a run-time failure if you ever tried to call
      the function (this is what #855 fixed).
      
      Thus the change in 2.2 essentially promoted a run-time failure to a
      compile-time failure, so isn't really a regression.
      
      This commit simply adds a `static_assert` with an accessible-base-class
      check so that, rather than just a cryptic cast failure, you get
      something more informative (along with a suggestion for a workaround).
      
      The workaround is to use a lambda, e.g.:
      
          class Derived : private Base {
          public:
              using Base::f;
          };
      
          // In binding code:
          //cl.def("f", &Derived::f); // fails: &Derived::f is actually a base
                                      // class member function pointer
          cl.def("f", [](Derived &self) { return self.f(); });
      
      This is a bit of a nuissance (especially if there are a bunch of
      arguments to forward), but I don't really see another solution.
      
      Fixes #1124
      Jason Rhinelander committed
    • Fix `char &` arguments being non-bindable · 1b08df58
      This changes the caster to return a reference to a (new) local `CharT`
      type caster member so that binding lvalue-reference char arguments
      works (currently it results in a compilation failure).
      
      Fixes #1116
      Jason Rhinelander committed
  2. 10 Oct, 2017 1 commit
  3. 08 Oct, 2017 1 commit
  4. 28 Sep, 2017 1 commit
  5. 21 Sep, 2017 1 commit
  6. 20 Sep, 2017 2 commits
  7. 16 Sep, 2017 3 commits
    • Simplify function signature annotation and parsing · 0aef6422
      `type_descr` is now applied only to the final signature so that it only
      marks the argument types, but not nested types (e.g. for tuples) or
      return types.
      Dean Moldovan committed
    • Use semi-constexpr signatures on MSVC · 56613945
      MSCV does not allow `&typeid(T)` in constexpr contexts, but the string
      part of the type signature can still be constexpr. In order to avoid
      `typeid` as long as possible, `descr` is modified to collect type
      information as template parameters instead of constexpr `typeid`.
      The actual `std::type_info` pointers are only collected in the end,
      as a `constexpr` (gcc/clang) or regular (MSVC) function call.
      
      Not only does it significantly reduce binary size on MSVC, gcc/clang
      benefit a little bit as well, since they can skip some intermediate
      `std::type_info*` arrays.
      Dean Moldovan committed
    • Make it possible to generate constexpr signatures in C++11 mode · c10ac6cf
      The current C++14 constexpr signatures don't require relaxed constexpr,
      but only `auto` return type deduction. To get around this in C++11,
      the type caster's `name()` static member functions are turned into
      `static constexpr auto` variables.
      Dean Moldovan committed
  8. 14 Sep, 2017 1 commit
  9. 13 Sep, 2017 4 commits
  10. 12 Sep, 2017 2 commits
  11. 11 Sep, 2017 1 commit
  12. 10 Sep, 2017 4 commits
  13. 08 Sep, 2017 4 commits
  14. 07 Sep, 2017 1 commit
  15. 06 Sep, 2017 3 commits
  16. 05 Sep, 2017 1 commit
  17. 04 Sep, 2017 2 commits
  18. 01 Sep, 2017 1 commit
  19. 31 Aug, 2017 4 commits
  20. 30 Aug, 2017 1 commit