summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
index f9801d2d421..c7257392ecc 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
@@ -118,8 +118,16 @@ int be_visitor_union_cs::visit_union (be_union *node)
// Get the first label in its list.
AST_UnionLabel *ul = ub->label (0);
-
- if (ul->label_kind () == AST_UnionLabel::UL_label)
+ AST_Union::DefaultValue dv;
+
+ // This can indicate an error in the return value, but it is
+ // caught elsewhere.
+ (void) node->default_value (dv);
+
+ bool test = dv.computed_ == 0
+ && ul->label_kind () == AST_UnionLabel::UL_label;
+
+ if (test)
{
ub->gen_label_value (os);
}