fix Issue 23145 - Stack allocation of scope new variables defeats @safe (#14175)

This commit is contained in:
Walter Bright 2023-02-08 23:29:07 -08:00 committed by GitHub
parent f1b70f41f7
commit 74e40179b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 103 additions and 42 deletions

View file

@ -38,12 +38,12 @@ extern (C) int printf(scope const char*, ...);
extern (C++) class CppA
{
int num;
this(int num)
this(int num) scope
{
this.num = num;
}
~this()
~this() scope
{
printf("%d: CppA.~this\n", num);
}
@ -51,12 +51,12 @@ extern (C++) class CppA
extern (C++) class CppB : CppA
{
this(int num)
this(int num) scope
{
super(num);
}
~this()
~this() scope
{
printf("%d: CppB.~this\n", num);
}
@ -64,12 +64,12 @@ extern (C++) class CppB : CppA
extern (C++) class CppC : CppB
{
this(int num)
this(int num) scope
{
super(num);
}
~this()
~this() scope
{
printf("%d: CppC.~this\n", num);
}
@ -78,12 +78,12 @@ extern (C++) class CppC : CppB
extern (D) class DA
{
int num;
this(int num)
this(int num) scope
{
this.num = num;
}
~this()
~this() scope
{
printf("%d: DA.~this\n", num);
}
@ -91,12 +91,12 @@ extern (D) class DA
extern (D) class DB : DA
{
this(int num)
this(int num) scope
{
super(num);
}
~this()
~this() scope
{
printf("%d: DB.~this\n", num);
}
@ -104,12 +104,12 @@ extern (D) class DB : DA
extern (D) class DC : DB
{
this(int num)
this(int num) scope
{
super(num);
}
~this()
~this() scope
{
printf("%d: DC.~this\n", num);
}
@ -118,7 +118,7 @@ extern (D) class DC : DB
extern (C++) class CppNoDestruct
{
int num;
this(int num)
this(int num) scope
{
this.num = num;
}