Using enum as a parameter weirdness. Bug or not?

I have some old code that used to work (tested with 2014r2.1 and it still worked back then)
Starting with 2014r3 this same code no longer seems to work.
I don’t know if it is expected behavior or not.

this is example code of the problem

Private Function CheckValue(CheckType As Integer, number1 As Double, number2 As Double) As Boolean Select Case CheckType Case ValComparison.Less if number1<number2 then Return true End Select End Function

I’m using an enumarator which is of the type integer

Public Enum ValComparison Less = VAL_LESS LessOrEqual = VAL_LESS_EQUAL Equal = VAL_EQUAL GreaterOrEqual = VAL_GREATER_EQUAL Greater = VAL_GREATER

the values here are based on constants
for instance

Const VAL_LESS = 4

The code is called this way

Dim bTestResult As Boolean bTestResult=CheckValue(ValComparison.Less,1, 2)

on 2014r2.1 all is fine and the code runs as expected.
starting with 2014r3 I get an error
Parameter “CheckType” expects type int32, but this is enum … valcomparison.

changing the code to

Private Function CheckValue(CheckType As Integer, number1 As Double, number2 As Double) As Boolean Select Case CheckType case VAL_LESS if number1<number2 then Return true End Select End Function
and calling it this way

Dim bTestResult As Boolean bTestResult=CheckValue(VAL_LESS,1, 2)
works

Changing the code to

Private Function CheckValue(CheckType As ValComparison, number1 As Double, number2 As Double) As Boolean Select Case CheckType case ValComparison.Less if number1<number2 then Return true End Select End Function
and calling it this way

Dim bTestResult As Boolean bTestResult=CheckValue(ValComparison.Less,1, 2)
also works

Since the enumerator is defined as integer, shouldn’t this still work?
ValComparison is indeed an enumarator, but its values are defined as integer (in the case of VAL_LESS, it’s 4)
The parameter “CheckType” for the function CheckValue is an integer

Strangely enough calling it with the constant VAL_LESS does work, although that one is not defined as integer, but as a number.
Also calling it by changing the parameter to be a ValComparison and passing it a ValComparison value (ie ValComparison.Less, therefore an integer) does work.

I think this might be related to feedback://showreport?report_id=35645.
Is my reasoning wrong, or is this a bug?

This is the right thing to do

Private Function CheckValue(CheckType As ValComparison, number1 As Double, number2 As Double) As Boolean
  Select Case CheckType
  case ValComparison.Less
    if number1<number2 then Return true
  End Select
End Function

A ValComparison is not an integer not is an integer a ValComparison

You need to

  1. change the param type
  2. use a call to ctype to convert the integer to a ValComparison

What confuses me is that when I define the enumeration ValComparison the IDE shows me that name of the enumeration is ValComparison, the type is integer, and I can select a scope.
So I find it confusing to see that a enumeration of type integer is not actually an integer.

No a big deal though, since I have two ways that work. It’s just that in the past the other way worked too.

Right
An Enum is NOT an integer - its based on an integer but its a new data type
It can be converted to and from an integer - but its not an integer

The old way basically let you get away with being less explicit about it
But that had all kinds of subtle behaviour bugs you could get in your code like accidentally assigning a value that was not part of the enum