Skip to content

Commit 41929f2

Browse files
committed
-preview=safer should ignore C files
1 parent 0531a9b commit 41929f2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/src/dmd/semantic3.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
294294
return;
295295
funcdecl.semanticRun = PASS.semantic3;
296296
funcdecl.hasSemantic3Errors = false;
297-
funcdecl.saferD = sc.previews.safer;
297+
funcdecl.saferD = sc.previews.safer && !sc.inCfile;
298298

299299
if (!funcdecl.type || funcdecl.type.ty != Tfunction)
300300
return;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// https://github.com/dlang/dmd/issues/22453
2+
// -preview=safer should ignore C files
3+
// REQUIRED_ARGS: -preview=safer
4+
int f(int *p)
5+
{
6+
return p[1];
7+
}

0 commit comments

Comments
 (0)