Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - 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.

# core.internal.dassert

string `_d_assert_fail`(A)(scope const string `op`, auto ref scope const A `a`);
  Generates rich assert error messages for unary expressions
  The unary expression assert(!una) will be turned into assert(!una, `_d_assert_fail`("!", una)). This routine simply acts as if the user wrote assert(una == false).
  Parameters:

  string `op` | Operator that was used in the expression, currently only "!" is supported.
  A `a` | Result of the expression that was used in assert before its implicit conversion to bool.

  Returns:
  A string such as "a != true" or "a == true".
template `_d_assert_fail`(A...)
  Generates rich assert error messages for binary expressions
  The binary expression assert(x == y) will be turned into assert(x == y, `_d_assert_fail`!(typeof(x))("==", x, y)).
  Parameters:

  string comp | Comparison operator that was used in the expression.
  A a | Left hand side operand (can be a tuple).
  B b | Right hand side operand (can be a tuple).

  Returns:
  A string such as "$a $comp $b".

Copyright © 1999-2023 by the D Language Foundation | Page generated by Ddoc on Wed Feb 1 17:26:14 2023