mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Merge pull request #4318 from tamasvajk/feature/pointer-cast
C#: Add implicit cast from array to pointer
This commit is contained in:
@@ -86,6 +86,15 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
return new ImplicitCast(info);
|
||||
}
|
||||
|
||||
if (conversion.IsIdentity && conversion.IsImplicit &&
|
||||
convertedType.Symbol is IPointerTypeSymbol &&
|
||||
!(resolvedType.Symbol is IPointerTypeSymbol))
|
||||
{
|
||||
// int[] -> int*
|
||||
// string -> char*
|
||||
return new ImplicitCast(info);
|
||||
}
|
||||
|
||||
// Default: Just create the expression without a conversion.
|
||||
return Factory.Create(info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user