Titan Core Initial Contribution
[deliverable/titan.core.git] / function_test / Semantic_Analyser / defpars / bende_t_SE.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2014 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 ******************************************************************************/
8 module bende_t_SE { //^In TTCN-3 module//
9
10 type record Cause
11 {
12 octetstring causeValue,
13 bitstring cS
14 }
15
16 type record PrivateExtension
17 {}
18
19 type set DownlinkDataNotificationFailureIndication
20 {
21 Cause cause,
22 PrivateExtension privateExtension optional
23 };
24
25
26 type union GTPCv2_PDUs
27 {
28 DownlinkDataNotificationFailureIndication downlinkDataNotificationFailureIndication
29 }
30
31 const bitstring zerobit := '0'B;
32
33 // GTPCv2_IE_Templates.ttcn:122
34 template Cause t_GTPCv2_IE_cause (
35 template bitstring pl_cS := // specific value, which is either:
36 '0'B, // V_BSTR
37 template octetstring pl_causeValue := omit
38 ) :=
39 {
40 causeValue := pl_causeValue,
41 cS := pl_cS
42 // The presence of this _parameterized_ template alone is not enough for fatal error.
43 // It has to be the default value of a parameter (template or function).
44 }
45
46 const octetstring cg_GTPv2_CV_UENotResponding := '57'O
47
48 // The original kaboom
49 template GTPCv2_PDUs t_GTPCv2_DataDownlinkNotificationFailureIndication(
50 template Cause pl_Cause := t_GTPCv2_IE_cause(pl_causeValue := cg_GTPv2_CV_UENotResponding)
51 ) :=
52 {
53 downlinkDataNotificationFailureIndication :=
54 {
55 cause := pl_Cause,
56 privateExtension := omit
57 }
58 } /* template t_GTPCv2_DataDownlinkNotificationFailureIndication */
59
60 // Parameterized template as default value => kaboom!
61 //function f(in template Cause p_cause := t_GTPCv2_IE_cause(pl_causeValue := cg_GTPv2_CV_UENotResponding)) runs on C
62 //{}
63
64 type component C {
65 var octetstring m_os;
66 var bitstring m_bs;
67 var template Cause mt_cause := {};
68 }
69
70 // correctly flagged as error:
71 // "default value cannot refer to a field of the component in the `runs on' clause"
72 function f2( //^In function definition// //^In formal parameter list:$//
73 in template Cause p_cause := mt_cause //^In parameter `p_cause':$// //^In default value:// \
74 //^error\: default value cannot refer to a field of the component in the \`runs on\' clause$//
75 ) runs on C
76 {}
77
78
79 testcase tc1() runs on C
80 {
81 // no problems here
82 var template Cause vt_cause := t_GTPCv2_IE_cause(pl_causeValue := cg_GTPv2_CV_UENotResponding);
83 }
84
85 }
This page took 0.032432 seconds and 5 git commands to generate.