Skip to content

Commit 9c4d030

Browse files
committed
Hopefully fix MSVC
Looks like MSVC doesn't like pure-virtual member functions on local classes so move the local types in `function`'s tests out to namespace scope.
1 parent 8b7c2f6 commit 9c4d030

1 file changed

Lines changed: 42 additions & 42 deletions

File tree

test/exec/test_function.cpp

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -181,60 +181,60 @@ namespace
181181
REQUIRE(ret == 42);
182182
}
183183

184-
TEST_CASE("exec::function accepts small trivially-copyable callables", "[types][function]")
184+
struct iface
185185
{
186-
struct iface
187-
{
188-
virtual exec::function<int() noexcept> get_i_virtually() const noexcept = 0;
189-
};
186+
virtual exec::function<int() noexcept> get_i_virtually() const noexcept = 0;
187+
};
190188

191-
struct iface2
189+
struct iface2
190+
{
191+
exec::function<int(iface2 const *) noexcept> get_i_from_base() const noexcept
192192
{
193-
exec::function<int(iface2 const *) noexcept> get_i_from_base() const noexcept
194-
{
195-
return exec::function<int(iface2 const *) noexcept>(this, &iface2::get_i_virtually);
196-
}
193+
return exec::function<int(iface2 const *) noexcept>(this, &iface2::get_i_virtually);
194+
}
197195

198-
virtual exec::function<int() noexcept> get_i_virtually() const noexcept = 0;
199-
};
196+
virtual exec::function<int() noexcept> get_i_virtually() const noexcept = 0;
197+
};
200198

201-
struct impl
202-
: iface
203-
, iface2
204-
{
205-
explicit impl(int i) noexcept
206-
: i_(i)
207-
{}
199+
struct impl
200+
: iface
201+
, iface2
202+
{
203+
explicit impl(int i) noexcept
204+
: i_(i)
205+
{}
208206

209-
auto just_i() const noexcept
210-
{
211-
return ex::just(i_);
212-
}
207+
auto just_i() const noexcept
208+
{
209+
return ex::just(i_);
210+
}
213211

214-
static auto static_just_i(impl const *self) noexcept
215-
{
216-
return self->just_i();
217-
}
212+
static auto static_just_i(impl const *self) noexcept
213+
{
214+
return self->just_i();
215+
}
218216

219-
exec::function<int() noexcept> get_i_with_capture() const noexcept
220-
{
221-
return exec::function<int() noexcept>([this]() noexcept { return just_i(); });
222-
}
217+
exec::function<int() noexcept> get_i_with_capture() const noexcept
218+
{
219+
return exec::function<int() noexcept>([this]() noexcept { return just_i(); });
220+
}
223221

224-
exec::function<int(impl const *) noexcept> get_i_with_pmfn() const noexcept
225-
{
226-
return exec::function<int(impl const *) noexcept>(this, &impl::just_i);
227-
}
222+
exec::function<int(impl const *) noexcept> get_i_with_pmfn() const noexcept
223+
{
224+
return exec::function<int(impl const *) noexcept>(this, &impl::just_i);
225+
}
228226

229-
exec::function<int() noexcept> get_i_virtually() const noexcept override
230-
{
231-
return get_i_with_capture();
232-
}
227+
exec::function<int() noexcept> get_i_virtually() const noexcept override
228+
{
229+
return get_i_with_capture();
230+
}
233231

234-
private:
235-
int i_;
236-
};
232+
private:
233+
int i_;
234+
};
237235

236+
TEST_CASE("exec::function accepts small trivially-copyable callables", "[types][function]")
237+
{
238238
SECTION("function<int() noexcept> accepts a lambda capturing this")
239239
{
240240
auto [ret] = ex::sync_wait(impl{42}.get_i_with_capture()).value();

0 commit comments

Comments
 (0)