aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd/dcast.d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-02-13 20:17:53 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2022-02-16 11:15:02 +0100
commitd75691877c4a7521a995d2601021fcaf30f65d94 (patch)
tree36509d835d63b98ad1130ac9d4695b5033c10428 /gcc/d/dmd/dcast.d
parent023327643969d5469902a9ecfa6738a315f9e362 (diff)
downloadgcc-d75691877c4a7521a995d2601021fcaf30f65d94.zip
gcc-d75691877c4a7521a995d2601021fcaf30f65d94.tar.gz
gcc-d75691877c4a7521a995d2601021fcaf30f65d94.tar.bz2
d: Merge upstream dmd 52844d4b1, druntime dbd0c874, phobos 896b1d0e1.
D front-end changes: - Parsing and compiling C code is now possible using `import'. - `throw' statements can now be used as an expression. - Improvements to the D template emission strategy when compiling with `-funittest'. D Runtime changes: - New core.int128 module for implementing intrinsics to support 128-bit integer types. - C bindings for the kernel and C runtime have been better separated to allow compiling for hybrid targets, such as kFreeBSD. Phobos changes: - The std.experimental.checkedint module has been renamed to std.checkedint. gcc/d/ChangeLog: * d-builtins.cc (d_build_builtins_module): Set purity of DECL_PURE_P functions to PURE::const_. * d-gimplify.cc (bit_field_ref): New function. (d_gimplify_modify_expr): Handle implicit casting for assignments to bit-fields. (d_gimplify_unary_expr): New function. (d_gimplify_binary_expr): New function. (d_gimplify_expr): Handle UNARY_CLASS_P and BINARY_CLASS_P. * d-target.cc (Target::_init): Initialize bitFieldStyle. (TargetCPP::parameterType): Update signature. (Target::supportsLinkerDirective): New function. * dmd/MERGE: Merge upstream dmd 52844d4b1. * expr.cc (ExprVisitor::visit (ThrowExp *)): New function. * types.cc (d_build_bitfield_integer_type): New function. (insert_aggregate_bitfield): New function. (layout_aggregate_members): Handle inserting bit-fields into an aggregate type. libphobos/ChangeLog: * Makefile.in: Regenerate. * libdruntime/MERGE: Merge upstream druntime dbd0c874. * libdruntime/Makefile.am (DRUNTIME_CSOURCES): Add core/int128.d. (DRUNTIME_DISOURCES): Add __builtins.di. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 896b1d0e1. * src/Makefile.am (PHOBOS_DSOURCES): Add std/checkedint.d. * src/Makefile.in: Regenerate. * testsuite/testsuite_flags.in: Add -fall-instantiations to --gdcflags.
Diffstat (limited to 'gcc/d/dmd/dcast.d')
-rw-r--r--gcc/d/dmd/dcast.d12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/d/dmd/dcast.d b/gcc/d/dmd/dcast.d
index 4a80d17..91b3861 100644
--- a/gcc/d/dmd/dcast.d
+++ b/gcc/d/dmd/dcast.d
@@ -858,11 +858,8 @@ MATCH implicitConvTo(Expression e, Type t)
* convert to immutable
*/
if (e.f &&
- (global.params.useDIP1000 != FeatureState.enabled || // lots of legacy code breaks with the following purity check
- e.f.isPure() >= PURE.strong ||
- // Special case exemption for Object.dup() which we assume is implemented correctly
- e.f.ident == Id.dup &&
- e.f.toParent2() == ClassDeclaration.object.toParent()) &&
+ // lots of legacy code breaks with the following purity check
+ (global.params.useDIP1000 != FeatureState.enabled || e.f.isPure() >= PURE.const_) &&
e.f.isReturnIsolated() // check isReturnIsolated last, because it is potentially expensive.
)
{
@@ -2245,9 +2242,12 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null)
ex = ex.castTo(sc, totuple ? (*totuple.arguments)[i].type : t);
(*te.exps)[i] = ex;
}
+ if (totuple)
+ te.type = totuple;
result = te;
- /* Questionable behavior: In here, result.type is not set to t.
+ /* Questionable behavior: In here, result.type is not set to t
+ * if target type is not a tuple of same length.
* Therefoe:
* TypeTuple!(int, int) values;
* auto values2 = cast(long)values;