Skip to content

Commit ca1b5a1

Browse files
WalterBrightdlang-bot
authored andcommitted
fix Issue 23694 and Issue 23700 Document ImportC CTFE
1 parent 4964b04 commit ca1b5a1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

spec/importc.dd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,20 @@ int myprintf(char *, ...) asm("printf");
424424
$(H3 $(LNAME2 ctfe, Compile Time Function Execution))
425425

426426
$(P Evaluating constant expressions includes executing functions in the
427-
same manner as D's CTFE can.)
427+
same manner as D's CTFE can.
428+
A $(I constant-expression) invokes CTFE.)
428429

430+
$(P Examples:)
431+
432+
$(CCODE
433+
_Static_assert("\x1"[0] == 1, "failed");
434+
435+
int mint1() { return -1; }
436+
_Static_assert(mint1() == -1, "failed");
437+
438+
const int a = 7;
439+
int b = a; // sets b to 7
440+
)
429441

430442
$(H3 $(LNAME2 inlining, Function Inlining))
431443

0 commit comments

Comments
 (0)