Skip to content

Commit acc2fe6

Browse files
Fix failing regression tests.
1 parent b7432b5 commit acc2fe6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

xsd_generate_base.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,18 @@ namespace classdesc
421421
// general, XML does not support polymorphism, so this won't really
422422
// work anyway.
423423
template <class T>
424-
void xsd_generate(xsd_generate_t& g, const string& d, const shared_ptr<T>& a)
424+
typename enable_if<Not<is_default_constructible<T> >, void>::T
425+
xsd_generate(xsd_generate_t& g, const string& d, const shared_ptr<T>& a)
425426
{
426-
xsd_generate_t::Optional o(g,true);
427-
xsd_generate(g,d,*a);
427+
xsd_generate_t::Optional o(g,true);
428+
if (a) xsd_generate(g,d,*a);
429+
}
430+
template <class T>
431+
typename enable_if<is_default_constructible<T>, void>::T
432+
xsd_generate(xsd_generate_t& g, const string& d, const shared_ptr<T>& a)
433+
{
434+
xsd_generate_t::Optional o(g,true);
435+
xsd_generate(g,d,T());
428436
}
429437

430438
template <class T>

0 commit comments

Comments
 (0)