+
+namespace {
+struct IFrobnicator {
+ template <class Base>
+ struct Interface : Base {
+ void frobnicate(folly::Poly<folly::poly::IRegular&> x) {
+ folly::poly_call<0>(*this, x);
+ }
+ };
+ template <class T>
+ using Members = FOLLY_POLY_MEMBERS(&T::frobnicate);
+};
+using Frobnicator = folly::Poly<IFrobnicator>;
+
+struct my_frobnicator {
+ void frobnicate(folly::Poly<folly::poly::IRegular&>) {
+ // no-op
+ }
+};
+} // namespace
+
+TEST(Poly, PolyRefAsArg) {
+ folly::Poly<folly::poly::IRegular> x = 42;
+ Frobnicator frob = my_frobnicator{};
+ // should not throw:
+ frob.frobnicate(x);
+ // should not throw:
+ frob.frobnicate(folly::Poly<folly::poly::IRegular&>(x));
+}