View source code
Display the source code in dmd/func.d from which this page was generated on github.
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 local clone.

Function dmd.func.setUnsafePreview

Like setUnsafe, but for safety errors still behind preview switches

bool setUnsafePreview (
  dmd.dscope.Scope* sc,
  FeatureState fs,
  bool gag,
  Loc loc,
  const(char)* msg,
  RootObject arg0 = null,
  RootObject arg1 = null,
  RootObject arg2 = null
);

Given a FeatureState fs, for example dip1000 / dip25 / systemVariables, the behavior changes based on the setting:

- In case of -revert=fs, it does nothing. - In case of -preview=fs, it's the same as setUnsafe - By default, print a deprecation in @safe functions, or store an attribute violation in inferred functions.

Parameters

NameDescription
sc used to find affected function/variable, and for checking whether we are in a deprecated / speculative scope
fs feature state from the preview flag
gag surpress error message
loc location of error
msg printf-style format string
arg0 (optional) argument for first %s format specifier
arg1 (optional) argument for second %s format specifier
arg2 (optional) argument for third %s format specifier

Returns

whether an actual safe error (not deprecation) occured

Authors

Walter Bright

License

Boost License 1.0