Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4033 from MartinNowak/fix12979
fix Issue 12979 - Nothrow violation error is hidden by inline assembler
- Loading branch information
Showing
15 changed files
with
217 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// REQUIRED_ARGS: -dw | ||
// PERMUTE_ARGS: | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
compilable/deprecate12979a.d(13): Deprecation: asm statement is assumed to throw - mark it with 'nothrow' if it does not | ||
--- | ||
*/ | ||
|
||
void foo() nothrow | ||
{ | ||
asm | ||
{ | ||
ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
void parse() | ||
{ | ||
asm pure nothrow @nogc @trusted {} | ||
asm @safe {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// REQUIRED_ARGS: -w -de | ||
|
||
void foo() pure nothrow @nogc @safe | ||
{ | ||
asm pure nothrow @nogc @trusted | ||
{ | ||
ret; | ||
} | ||
} | ||
|
||
void bar()() | ||
{ | ||
asm pure nothrow @nogc @trusted | ||
{ | ||
ret; | ||
} | ||
} | ||
|
||
static assert(__traits(compiles, () pure nothrow @nogc @safe => bar())); | ||
|
||
void baz()() | ||
{ | ||
asm | ||
{ | ||
ret; | ||
} | ||
} | ||
|
||
// wait for deprecation of asm pure inference | ||
// static assert(!__traits(compiles, () pure => baz())); | ||
static assert(!__traits(compiles, () nothrow => baz())); | ||
// wait for deprecation of asm @nogc inference | ||
// static assert(!__traits(compiles, () @nogc => baz())); | ||
static assert(!__traits(compiles, () @safe => baz())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// REQUIRED_ARGS: -de | ||
// PERMUTE_ARGS: | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/deprecate12979a.d(14): Deprecation: asm statement is assumed to throw - mark it with 'nothrow' if it does not | ||
fail_compilation/deprecate12979a.d(12): Error: function 'deprecate12979a.foo' is nothrow yet may throw | ||
--- | ||
*/ | ||
|
||
void foo() nothrow | ||
{ | ||
asm | ||
{ | ||
ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// REQUIRED_ARGS: -de | ||
// PERMUTE_ARGS: | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/deprecate12979b.d(13): Deprecation: asm statement is assumed to be impure - mark it with 'pure' if it is not | ||
--- | ||
*/ | ||
|
||
void foo() pure | ||
{ | ||
asm | ||
{ | ||
ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// REQUIRED_ARGS: -de | ||
// PERMUTE_ARGS: | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/deprecate12979c.d(13): Deprecation: asm statement is assumed to use the GC - mark it with '@nogc' if it does not | ||
--- | ||
*/ | ||
|
||
void foo() @nogc | ||
{ | ||
asm | ||
{ | ||
ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// PERMUTE_ARGS: | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/deprecate12979d.d(12): Error: asm statement is assumed to be @system - mark it with '@trusted' if it is not | ||
--- | ||
*/ | ||
|
||
void foo() @safe | ||
{ | ||
asm | ||
{ | ||
ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// PERMUTE_ARGS: | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/test12979.d(13): Error: const/immutable/shared/inout attributes are not allowed on asm blocks | ||
--- | ||
*/ | ||
|
||
void foo() | ||
{ | ||
asm const shared | ||
{ | ||
ret; | ||
} | ||
} |