File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -2854,7 +2854,8 @@ $(H4 $(LNAME2 assert-ct, Compile-time Evaluation))
28542854 $(P If the first $(I AssignExpression) consists entirely of compile time constants,
28552855 and evaluates to `false`, it is a special case - it
28562856 signifies that subsequent statements are unreachable code.
2857- Compile Time Function Execution (CTFE) is not attempted.
2857+ Compile Time Function Execution (CTFE) calls are not attempted for the evaluation.
2858+ Such an $(GLINK AssertExpression) has type $(DDSUBLINK spec/type, noreturn, `noreturn`).
28582859 )
28592860
28602861 $(P This allows the compiler to suppress an error when there is a
Original file line number Diff line number Diff line change @@ -903,13 +903,18 @@ $(H3 $(LNAME2 noreturn, $(D noreturn)))
903903 A value of type `noreturn` will never be produced and the compiler can
904904 optimize such code accordingly.)
905905
906+ $(P `noreturn.init` lowers to $(DDSUBLINK spec/expression, assert-ct, `assert(0)`).)
907+
906908 $(P A function that $(DDSUBLINK spec/function, function-return-values, never returns)
907909 has the return type `noreturn`. This can
908- occur due to an infinite loop or always throwing an exception.)
910+ occur due to e.g. an infinite loop or always throwing an exception.
911+ A function returning type `noreturn` is covariant with a function returning any other type.)
909912
910913$(SPEC_RUNNABLE_EXAMPLE_COMPILE
911914---
912- noreturn abort(const(char)[] message);
915+ noreturn abort(string message);
916+
917+ int function(string) fp = &abort; // OK
913918
914919int example(int i)
915920{
@@ -925,7 +930,9 @@ int example(int i)
925930)
926931
927932 $(P `noreturn` is defined as $(D typeof(*null)). This is because
928- dereferencing a null literal halts execution.)
933+ dereferencing a null literal (typically) halts execution.)
934+
935+ $(P See also: $(GLINK2 expression, ThrowExpression))
929936
930937
931938$(SPEC_SUBNAV_PREV_NEXT declaration, Declarations, property, Properties)
You can’t perform that action at this time.
0 commit comments