Sync with 5.4.0
[deliverable/titan.core.git] / function_test / Semantic_Analyser / defpars / bende_t_SE.ttcn
CommitLineData
114d1c9a 1/******************************************************************************
3abe9331 2 * Copyright (c) 2000-2015 Ericsson Telecom AB
114d1c9a
EL
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 ******************************************************************************/
8module bende_t_SE { //^In TTCN-3 module//
9
10type record Cause
11{
12 octetstring causeValue,
13 bitstring cS
14}
15
16type record PrivateExtension
17{}
18
19type set DownlinkDataNotificationFailureIndication
20{
21 Cause cause,
22 PrivateExtension privateExtension optional
23};
24
25
26type union GTPCv2_PDUs
27{
28 DownlinkDataNotificationFailureIndication downlinkDataNotificationFailureIndication
29}
30
31const bitstring zerobit := '0'B;
32
33// GTPCv2_IE_Templates.ttcn:122
34template 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
46const octetstring cg_GTPv2_CV_UENotResponding := '57'O
47
48// The original kaboom
49template 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
64type 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"
72function 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
79testcase 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.028208 seconds and 5 git commands to generate.