[xsd-users] XSD C++ code generation error
Mikhail Evstiounin
mikhail.evstiounin at gmail.com
Thu Mar 17 19:28:57 EDT 2011
Hi,
XSD generated the following code:
hxx file:
namespace xml_schema
{
…
…
typedef ::xsd::cxx::tree::type type;
…
namespace up
{
…
class results: public ::xml_schema::type
{
…
static const success_type success_default_value_;
…
};
…
}
…
}
cxx file:
namespace xml_schema
{
…
namespace up
{
…
typedef ::xml_schema::type success_type;
…
const results::success_type results::success_default_value_( );
…
}
…
}
It produces the following error (gcc 4.1.1):
document-envelope.cxx:2882: error: no ‘const xml_schema::type
up::results::success_default_value_()’ member function declared in class
'up::results'
document-envelope.cxx:2882: error: declaration of ‘const xml_schema::type
up::results::success_default_value_()’ outside of class is not definition
If you change it a little bit:
namespace xml_schema
{
…
namespace up
{
…
const results::success_type results::success_default_value_;// ( );
…
}
…
}
It compiles normally.
Since there is no default value this type of declaration (of a class static
member) is considered as a function definition. Per many C++ name resolution
discussions, rationale is made to lean to a "function definition", not a
"variable declaration" -- too many code rely on it.
Proposal -- to fix XSD in part of static member declaration not to use "()"
if default c-tor is used.
Truly yours
Mikhail Evstiounin
More information about the xsd-users
mailing list