/***************************************************************** ** @author STF 487 ** @version 0.0.1 ** @purpose 1:15.6.5, Ensure that referencing an alternative of a union template field to which the ifpresent attribute is attached, shall cause an error ** @verdict pass reject *****************************************************************/ //Restriction c) /*Ifpresent attribute: referencing an alternative of a union template field to which the ifpresent attribute is attached, shall cause an error (irrespective of the value or the matching mechanism to which ifpresent is appended).*/ module NegSem_150605_Referencing_union_alternatives_005 { type record My_Rec { integer r1 , float r2 optional } type union My_Union { integer u1, My_Rec u2 } type component GeneralComp { } testcase TC_NegSem_150605_Referencing_union_alternatives_005() runs on GeneralComp { var template My_Rec m_template; var template My_Union My_Template; My_Template.u1 := 1; My_Template.u2 := {r1:=1, r2:=0.1 ifpresent} ; m_template := My_Template.u2; //error: ifpresent attribute is attached setverdict(pass); } control{ execute(TC_NegSem_150605_Referencing_union_alternatives_005()); } }