Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,9 @@ private void VisitImplicitCastExpr(ImplicitCastExpr implicitCastExpr)
// value type, which has no implicit pointer conversion, so take its address to
// bind it to a pointer. A compatible-mode fixed buffer decays on its own, and
// array locals (managed arrays) or string literals must not be addressed here.
if (!Config.GenerateCompatibleCode && (subExpr is MemberExpr) && (subExpr.Type.CanonicalType is ConstantArrayType) && (implicitCastExpr.Type.CanonicalType is PointerType))
// A subscripted field (`arr[i]`) indexes the inline array in place, so the decay
// there is an lvalue that must not be addressed.
if (!Config.GenerateCompatibleCode && (subExpr is MemberExpr) && (subExpr.Type.CanonicalType is ConstantArrayType) && (implicitCastExpr.Type.CanonicalType is PointerType) && !IsPrevContextStmt<ArraySubscriptExpr>(out _, out _))
{
outputBuilder.Write('&');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static unsafe partial class Methods
public static void MyFunction([NativeTypeName("struct MyStruct *")] MyStruct* pStruct)
{
MyOtherFunction(pStruct->Data);
pStruct->Data[15] = 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static unsafe partial class Methods
public static void MyFunction([NativeTypeName("struct MyStruct *")] MyStruct* pStruct)
{
MyOtherFunction(pStruct->Data);
pStruct->Data[15] = 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static unsafe partial class Methods
public static void MyFunction([NativeTypeName("struct MyStruct *")] MyStruct* pStruct)
{
MyOtherFunction(&pStruct->Data);
pStruct->Data[15] = 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static unsafe partial class Methods
public static void MyFunction([NativeTypeName("struct MyStruct *")] MyStruct* pStruct)
{
MyOtherFunction(&pStruct->Data);
pStruct->Data[15] = 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static unsafe partial class Methods
public static void MyFunction([NativeTypeName("struct MyStruct *")] MyStruct* pStruct)
{
MyOtherFunction(&pStruct->Data);
pStruct->Data[15] = 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static unsafe partial class Methods
public static void MyFunction([NativeTypeName("struct MyStruct *")] MyStruct* pStruct)
{
MyOtherFunction(&pStruct->Data);
pStruct->Data[15] = 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static unsafe partial class Methods
public static void MyFunction([NativeTypeName("struct MyStruct *")] MyStruct* pStruct)
{
MyOtherFunction(&pStruct->Data);
pStruct->Data[15] = 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static unsafe partial class Methods
public static void MyFunction([NativeTypeName("struct MyStruct *")] MyStruct* pStruct)
{
MyOtherFunction(&pStruct->Data);
pStruct->Data[15] = 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<param name="pStruct">
<type>MyStruct*</type>
</param>
<code>MyOtherFunction(pStruct-&gt;Data);</code>
<code>MyOtherFunction(pStruct-&gt;Data);
pStruct-&gt;Data[15] = 1;</code>
</function>
</class>
</namespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<param name="pStruct">
<type>MyStruct*</type>
</param>
<code>MyOtherFunction(pStruct-&gt;Data);</code>
<code>MyOtherFunction(pStruct-&gt;Data);
pStruct-&gt;Data[15] = 1;</code>
</function>
</class>
</namespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<param name="pStruct">
<type>MyStruct*</type>
</param>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);</code>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);
pStruct-&gt;Data[15] = 1;</code>
</function>
</class>
</namespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<param name="pStruct">
<type>MyStruct*</type>
</param>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);</code>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);
pStruct-&gt;Data[15] = 1;</code>
</function>
</class>
</namespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<param name="pStruct">
<type>MyStruct*</type>
</param>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);</code>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);
pStruct-&gt;Data[15] = 1;</code>
</function>
</class>
</namespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<param name="pStruct">
<type>MyStruct*</type>
</param>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);</code>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);
pStruct-&gt;Data[15] = 1;</code>
</function>
</class>
</namespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<param name="pStruct">
<type>MyStruct*</type>
</param>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);</code>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);
pStruct-&gt;Data[15] = 1;</code>
</function>
</class>
</namespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<param name="pStruct">
<type>MyStruct*</type>
</param>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);</code>
<code>MyOtherFunction(&amp;pStruct-&gt;Data);
pStruct-&gt;Data[15] = 1;</code>
</function>
</class>
</namespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct MyStruct
void MyFunction(struct MyStruct* pStruct)
{
MyOtherFunction(pStruct->Data);
pStruct->Data[15] = 1;
}
";

Expand Down
Loading