Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# dmd.dcast

Semantic analysis for cast-expressions.
Authors:
Walter Bright
License:
Boost License 1.0

Source dcast.d

Documentation https://dlang.org/phobos/dmd_dcast.html

Coverage https://codecov.io/gh/dlang/dmd/src/master/src/dmd/dcast.d

Expression `implicitCastTo`(Expression `e`, Scope* `sc`, Type `t`);
  Do an implicit cast. Issue error if it can't be done.
MATCH `implicitConvTo`(Expression `e`, Type `t`);
  Return MATCH level of implicitly converting e to type t. Don't do the actual cast; don't change e.
Expression `castTo`(Expression `e`, Scope* `sc`, Type `t`);
  Do an explicit cast. Assume that the 'this' expression does not have any indirections.
Expression `inferType`(Expression `e`, Type `t`, int `flag` = 0);
  Set type inference target t Target type flag 1: don't put an error when inference fails
Expression `scaleFactor`(BinExp `be`, Scope* `sc`);
  Scale addition/subtraction to/from pointer.
bool `typeMerge`(Scope* `sc`, TOK `op`, Type* `pt`, Expression* `pe1`, Expression* `pe2`);
  Combine types.

  Output *pt merged type, if *pt is not NULL *pe1 rewritten e1 *pe2 rewritten e2

  Returns:
  true success false failed
Expression `typeCombine`(BinExp `be`, Scope* `sc`);
  Bring leaves to common type.
  Returns:
  null on success, ErrorExp if error occurs
Expression `integralPromotions`(Expression `e`, Scope* `sc`);
  Do integral promotions (convertchk). Don't convert to
void `fix16997`(Scope* `sc`, UnaExp `ue`);
  This provides a transition from the non-promoting behavior of unary + - ~ to the C-like integral promotion behavior.
  Parameters:

  Scope* `sc` | context
  UnaExp `ue` | NegExp, UAddExp, or ComExp which is revised per rules

  References https://issues.dlang.org/show_bug.cgi?id=16997

bool `arrayTypeCompatible`(Loc `loc`, Type `t1`, Type `t2`);
  See if both types are arrays that can be compared for equality. Return true if so. If they are arrays, but incompatible, issue error. This is to enable comparing things like an immutable array with a mutable one.
bool `arrayTypeCompatibleWithoutCasting`(Type `t1`, Type `t2`);
  See if both types are arrays that can be compared for equality without any casting. Return true if so. This is to enable comparing things like an immutable array with a mutable one.
IntRange `getIntRange`(Expression `e`);

Copyright © 1999-2020 by the D Language Foundation | Page generated by Ddoc on Thu Jun 11 11:22:54 2020