Fix the bug that cast should not be public.

cast is a templated function and should
not be public.

Test: `mma`
Change-Id: I30193e022c210c78b16fdf3b5f331a0ef3cbbb27
diff --git a/ArrayType.cpp b/ArrayType.cpp
index 9d3f8ff..6b4a01b 100644
--- a/ArrayType.cpp
+++ b/ArrayType.cpp
@@ -36,7 +36,7 @@
 }
 
 void ArrayType::addDimension(ConstantExpression *size) {
-    mSizes.insert(mSizes.begin(), size->cast<size_t>());
+    mSizes.insert(mSizes.begin(), size->castSizeT());
     mSizeComments.insert(mSizeComments.begin(), size->description());
 }
 
diff --git a/ConstantExpression.cpp b/ConstantExpression.cpp
index 680a5d2..9c98046 100644
--- a/ConstantExpression.cpp
+++ b/ConstantExpression.cpp
@@ -400,6 +400,10 @@
     SWITCH_KIND(mValueKind, CASE_CAST_T, SHOULD_NOT_REACH(); return 0; );
 }
 
+size_t ConstantExpression::castSizeT() const {
+    return this->cast<size_t>();
+}
+
 /*
 
 Evaluating expressions in HIDL language
diff --git a/ConstantExpression.h b/ConstantExpression.h
index 2e859b0..ba1ca14 100644
--- a/ConstantExpression.h
+++ b/ConstantExpression.h
@@ -73,12 +73,8 @@
     ConstantExpression addOne() const;
     /* Assignment operator. */
     ConstantExpression& operator=(const ConstantExpression& other);
-    /*
-     * Return the value casted to the given type.
-     * First cast it according to mValueKind, then cast it to T.
-     * Assumes !containsIdentifiers()
-     */
-    template <typename T> T cast() const;
+
+    size_t castSizeT() const;
 
 private:
     /* The formatted expression. */
@@ -98,6 +94,13 @@
     std::string rawValue(ScalarType::Kind castKind) const;
     /* Trim unnecessary information. Only mValue and mValueKind is kept. */
     ConstantExpression &toLiteral();
+
+    /*
+     * Return the value casted to the given type.
+     * First cast it according to mValueKind, then cast it to T.
+     * Assumes !containsIdentifiers()
+     */
+    template <typename T> T cast() const;
 };
 
 }  // namespace android