summaryrefslogtreecommitdiff
path: root/gcc/d/dmd/statementsem.d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-07-26 18:13:54 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2022-07-26 23:43:13 +0200
commit81a0fa31ce96327618023b476ea121dbe2494b04 (patch)
tree7a92b40bb7124e7e2449fef9983e22db836a0f65 /gcc/d/dmd/statementsem.d
parent2009850b2b7042a678c385cd72e6ceb40caac8cd (diff)
d: Merge upstream dmd 76e3b41375, druntime 1462ebd1, phobos 5fef0d28f.
Updates D language version to v2.100.1. D front-end changes: - Fix delegate literal with inferred return value that requires following alias-this to not use class cast. - Fix internal error on variadic template type instantiated with two arrays of classes. - `scope(failure)' blocks that contain `return' statements are now deprecated. - Fix regression where wrong cast was inserted for ternary operator and non-int enums. - Fix internal error in code generation trying to reference _d_arraysetctor. - Fix memory corruption when array literal is passed to map in lambda, then returned from nested function. - Generate invariant id on the basis of location rather than a global counter. - Make `noreturn' conversions work. - Fix segfault when `.stringof' of template alias overloaded with function accessed by trait. - Empty array literal passed to scope param not 'falsey' anymore. Phobos changes: - Avoid copying ranges in std.algorithm.comparison.equal. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 76e3b41375. * dmd/VERSION: Bump version to v2.100.1. * decl.cc (DeclVisitor::visit (VarDeclaration *)): Evaluate RHS of noreturn declaration expressions first. * expr.cc (ExprVisitor::visit (AssignExp *)): Don't generate assignment for noreturn types. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 1462ebd1. * src/MERGE: Merge upstream phobos 5fef0d28f.
Diffstat (limited to 'gcc/d/dmd/statementsem.d')
-rw-r--r--gcc/d/dmd/statementsem.d16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/d/dmd/statementsem.d b/gcc/d/dmd/statementsem.d
index 2916bbc38dd..c1c2dc92e12 100644
--- a/gcc/d/dmd/statementsem.d
+++ b/gcc/d/dmd/statementsem.d
@@ -2829,10 +2829,20 @@ package (dmd) extern (C++) final class StatementSemanticVisitor : Visitor
rs.error("`return` statements cannot be in contracts");
errors = true;
}
- if (sc.os && sc.os.tok != TOK.onScopeFailure)
+ if (sc.os)
{
- rs.error("`return` statements cannot be in `%s` bodies", Token.toChars(sc.os.tok));
- errors = true;
+ // @@@DEPRECATED_2.112@@@
+ // Deprecated in 2.100, transform into an error in 2.112
+ if (sc.os.tok == TOK.onScopeFailure)
+ {
+ rs.deprecation("`return` statements cannot be in `scope(failure)` bodies.");
+ deprecationSupplemental(rs.loc, "Use try-catch blocks for this purpose");
+ }
+ else
+ {
+ rs.error("`return` statements cannot be in `%s` bodies", Token.toChars(sc.os.tok));
+ errors = true;
+ }
}
if (sc.tf)
{