Visual Studio 2010 vs Visual Studio 2013 - Various Compiler Errors - Why?

We noticed something strange that we could not explain. In the class, we had these two functions:

   Public Overloads Shared Function ToList(ByVal input As Object, _
                                    Optional ByVal StringSeparator As String = ";", _
                                    Optional ByVal CharacterCasing As String = "", _
                                    Optional ByVal StartRow As Integer = 0, _
                                    Optional ByVal EndRow As Integer = -1) As String
            ...
   End Sub

   Public Overloads Shared Function ToList(ByVal Input As Object, _
                            Optional ByVal SplitStringSeparator As String = ",", _
                            Optional ByVal JoinStringSeparator As String = ",", _
                            Optional ByVal PreFixStr As String = "", _
                            Optional ByVal PostFixStr As String = "") As String
           ...
  End Sub

If we try to compile this project in VS2013, we will not get any errors. If we try to compile this exact project in VS 2010, it will give the following error (which makes sense):

1 ' ToList ( , [StringSeparator As String = ";" ], [CharacterCasing As String = "], [StartRow As Integer = 0], [EndRow As Integer = -1]) String ' 'ToList (Input As Object, [SplitStringSeparator As String =", "], [JoinStringSeparator As String =", "], [PreFixStr As String =" "], [PostFixStr As String =" "]) String ' ,

2 ' ToList ( , [StringSeparator As String = ";" ], [CharacterCasing As String = "], [StartRow As Integer = 0], [EndRow As Integer = -1]) String ' 'ToList (Input As Object, [SplitStringSeparator As String =", "], [JoinStringSeparator As String =", "], [PreFixStr As String =" "], [PostFixStr As String =" "]) String ' , .

- , SAME-, SAME VS, , ?

+4
1

, , , , . : vb\language\compiler\symbols\symboltable.cpp, BCSYM:: CompareParams().

    // make sure the types being used for the default are the same
    if ( ParmTypeCompareFlags & ( EQ_Shape | EQ_GenericTypeParams ))
    {
        ComparisonFlags |= EQ_OptionalTypes;

        // don't percolate the difference in the type shape on in this case - the difference we care about it is EQ_OptionalTypes
        ParmTypeCompareFlags &= ~(EQ_Shape | EQ_GenericTypeParams);   // <== Here
    }

EQ_Shape - , , . , VS2010, .

, , . 4.1.1 , :

, , . , :

Sub F (x As Short, _
       y As Integer = 10, _
       z As Long = 20)

:
• F ()
• F (, )
• F (, , )

, , . , , BC30521, " ". connect.microsoft.com

+6

Source: https://habr.com/ru/post/1537782/


All Articles