File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,12 +51,17 @@ class TestMoreDerivedType : public TestDerivedType
5151
5252std::shared_ptr<TestBaseType> derived_type_factory ()
5353{
54- return std::shared_ptr<TestBaseType>( new TestDerivedType () );
54+ return std::make_shared<TestDerivedType>( );
5555}
5656
5757std::shared_ptr<TestBaseType> more_derived_type_factory ()
5858{
59- return std::shared_ptr<TestBaseType>(new TestMoreDerivedType ());
59+ return std::make_shared<TestBaseType>();
60+ }
61+
62+ std::shared_ptr<TestBaseType> null_factory ()
63+ {
64+ return std::shared_ptr<TestBaseType>();
6065}
6166
6267std::string hello_world ()
@@ -111,6 +116,7 @@ CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_test_mo
111116
112117 m->add (chaiscript::fun (&derived_type_factory), " derived_type_factory" );
113118 m->add (chaiscript::fun (&more_derived_type_factory), " more_derived_type_factory" );
119+ m->add (chaiscript::fun (&null_factory), " null_factory" );
114120
115121 m->add (chaiscript::fun (&TestDerivedType::func), " func" );
116122
Original file line number Diff line number Diff line change 1+ load_module("test_module")
2+
3+ auto o = null_factory();
4+
5+ try {
6+ o.func();
7+ } catch (e) {
8+ exit(0);
9+ }
10+
11+ assert_true(false);
12+
13+
You can’t perform that action at this time.
0 commit comments