Skip to content

Commit

Permalink
fix Issue 19734 - isDataseg returns true for non-static declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Mar 13, 2019
1 parent 792742d commit 2515063
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dmd/declaration.d
Expand Up @@ -1300,6 +1300,7 @@ extern (C++) class VarDeclaration : Declaration
else if (storage_class & (STC.static_ | STC.extern_ | STC.tls | STC.gshared) ||
parent.isModule() || parent.isTemplateInstance() || parent.isNspace())
{
assert(!isParameter() && !isResult());
isdataseg = 1; // It is in the DataSegment
}
}
Expand Down
36 changes: 36 additions & 0 deletions test/runnable/test19734.d
@@ -0,0 +1,36 @@
// https://issues.dlang.org/show_bug.cgi?id=19734
// REQUIRED_ARGS: -main

class C19734
{
import core.stdc.stdarg;

extern
{
// Invalid 'this' parameter because of applied 'extern' storage class.
void testin(typeof(this) p)
in(this is p)
{
}

// Undefined reference to __result.
int testout()
out(; __result == 2)
{
return 2;
}

// Undefined reference to var.
int testlocal()
{
int var;
return var + 2;
}

// Variable _argptr cannot have initializer.
int testvarargs(...)
{
return 0;
}
}
}

0 comments on commit 2515063

Please sign in to comment.