Faulty code for select union
Submitted by G??bor Szalai
Link to original bug (#559371)
Description
Faulty code generated for select union in the case of optional field
The following code fail
module proba{
type set HTTP2_headers_struct { HTTP2_content_type content_type optional
}
type union HTTP2_content_type { integer application, charstring multipart }
type component CT {} testcase TC() runs on CT{ var HTTP2_headers_struct vl_headers; vl_headers := { content_type := { application := 1 } }
select union( vl_headers.content_type ) { case (multipart) { setverdict(fail) log("=====multipart") } case (application) { setverdict(pass) log("=====application") }
}
}
control{ execute(TC()) }
}
The generated code: switch(const_cast< const HTTP2__headers__struct&>(vl__headers).content__type().get_selection()) {
should be: switch(const_cast< const HTTP2__headers__struct&>(vl__headers).content__type()().get_selection()) {
Version: 6.6.1