@@ -252,7 +252,7 @@ pure int foo(int i,
252
252
references of the result may be assumed to not refer to any object that
253
253
existed before the function call. For example:)
254
254
255
- $(SPEC_RUNNABLE_EXAMPLE
255
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
256
256
---
257
257
struct List { int payload; List* next; }
258
258
pure List* make(int a, int b)
@@ -322,7 +322,7 @@ $(H2 $(LNAME2 auto-functions, Auto Functions))
322
322
If there are no $(I ReturnStatement)s, the return type is inferred
323
323
to be $(D_KEYWORD void).)
324
324
325
- $(SPEC_RUNNABLE_EXAMPLE
325
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
326
326
---
327
327
auto foo(int x) { return x + 3; } // inferred to be int
328
328
auto bar(int x) { return x; return 2.5; } // inferred to be double
@@ -337,7 +337,7 @@ $(H2 $(LNAME2 auto-ref-functions, Auto Ref Functions))
337
337
if all return expressions are lvalues,
338
338
and it would not be a reference to a local or a parameter.)
339
339
340
- $(SPEC_RUNNABLE_EXAMPLE
340
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
341
341
---
342
342
auto ref f1(int x) { return x; } // value return
343
343
auto ref f2() { return 3; } // value return
@@ -350,7 +350,7 @@ $(H2 $(LNAME2 auto-ref-functions, Auto Ref Functions))
350
350
$(P The ref-ness of a function is determined from all
351
351
$(GLINK2 statement, ReturnStatement)s in the function body:)
352
352
353
- $(SPEC_RUNNABLE_EXAMPLE
353
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
354
354
---
355
355
auto ref f1(ref int x) { return 3; return x; } // ok, value return
356
356
auto ref f2(ref int x) { return x; return 3; } // ok, value return
@@ -375,7 +375,7 @@ $(H2 $(LNAME2 inout-functions, Inout Functions))
375
375
$(P Functions that deal with mutable, const, or immutable types with
376
376
equanimity often need to transmit their type to the return value:)
377
377
378
- $(SPEC_RUNNABLE_EXAMPLE
378
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
379
379
---
380
380
int[] f1(int[] a, int x, int y) { return a[x .. y]; }
381
381
@@ -389,7 +389,7 @@ $(H2 $(LNAME2 inout-functions, Inout Functions))
389
389
To indicate that these can be one function, the $(D_KEYWORD inout)
390
390
type constructor is employed:)
391
391
392
- $(SPEC_RUNNABLE_EXAMPLE
392
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
393
393
---
394
394
inout(int)[] foo(inout(int)[] a, int x, int y) { return a[x .. y]; }
395
395
---
@@ -433,7 +433,7 @@ $(H2 $(LNAME2 inout-functions, Inout Functions))
433
433
$(P The inout in the return type is then rewritten to be the inout matched
434
434
qualifiers:)
435
435
436
- $(SPEC_RUNNABLE_EXAMPLE
436
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
437
437
---
438
438
int[] ma;
439
439
const(int)[] ca;
@@ -485,7 +485,7 @@ $(H2 $(LNAME2 optional-parenthesis, Optional Parentheses))
485
485
$(RELATIVE_LINK2 property-functions, property function).
486
486
)
487
487
488
- $(SPEC_RUNNABLE_EXAMPLE
488
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
489
489
---
490
490
void foo() {} // no arguments
491
491
void fun(int x = 10) { }
@@ -523,7 +523,7 @@ $(H2 $(LNAME2 optional-parenthesis, Optional Parentheses))
523
523
returned value is to be called.
524
524
)
525
525
526
- $(SPEC_RUNNABLE_EXAMPLE
526
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
527
527
---
528
528
struct S {
529
529
int function() callfp() { return &numfp; }
@@ -592,7 +592,7 @@ $(H2 $(LNAME2 property-functions, Property Functions))
592
592
$(P A simple property would be:)
593
593
594
594
595
- $(SPEC_RUNNABLE_EXAMPLE
595
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
596
596
---
597
597
struct Foo
598
598
{
@@ -704,7 +704,7 @@ void func()
704
704
that is derived from the type returned by the overridden function:
705
705
)
706
706
707
- $(SPEC_RUNNABLE_EXAMPLE
707
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
708
708
------
709
709
class A { }
710
710
class B : A { }
@@ -731,7 +731,7 @@ class Bar : Foo
731
731
base class name before the member function name. For example:
732
732
)
733
733
734
- $(SPEC_RUNNABLE_EXAMPLE
734
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
735
735
------
736
736
class B
737
737
{
@@ -924,7 +924,7 @@ void test()
924
924
$(GLINK FunctionAttributes), the missing attributes will be
925
925
automatically compensated by the compiler.)
926
926
927
- $(SPEC_RUNNABLE_EXAMPLE
927
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
928
928
------
929
929
class B
930
930
{
@@ -951,7 +951,7 @@ void main()
951
951
when it is virtual.
952
952
)
953
953
954
- $(SPEC_RUNNABLE_EXAMPLE
954
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
955
955
------
956
956
class B
957
957
{
@@ -1055,7 +1055,7 @@ $(H3 $(LNAME2 overload-sets, Overload Sets))
1055
1055
at module level:
1056
1056
)
1057
1057
1058
- $(SPEC_RUNNABLE_EXAMPLE
1058
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1059
1059
---
1060
1060
module A;
1061
1061
void foo() { }
@@ -1067,7 +1067,7 @@ void foo(long i) { }
1067
1067
A different module can also define functions with the same name:
1068
1068
)
1069
1069
1070
- $(SPEC_RUNNABLE_EXAMPLE
1070
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1071
1071
---
1072
1072
module B;
1073
1073
class C { }
@@ -1166,7 +1166,7 @@ int foo(in int x, out int y, ref int z, int q);
1166
1166
$(TROW $(D inout), argument is implicitly converted to an inout type)
1167
1167
)
1168
1168
1169
- $(SPEC_RUNNABLE_EXAMPLE
1169
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1170
1170
------
1171
1171
void foo(out int x)
1172
1172
{
@@ -1208,7 +1208,7 @@ def(z);
1208
1208
a $(D lazy) argument can be executed 0 or more times. A $(D lazy) parameter
1209
1209
cannot be an lvalue.)
1210
1210
1211
- $(SPEC_RUNNABLE_EXAMPLE
1211
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1212
1212
---
1213
1213
void dotimes(int n, lazy void exp)
1214
1214
{
@@ -1374,7 +1374,7 @@ $(H4 $(LNAME2 d_style_variadic_functions, D-style Variadic Functions))
1374
1374
It has D linkage, and need not have any non-variadic parameters
1375
1375
declared:)
1376
1376
1377
- $(SPEC_RUNNABLE_EXAMPLE
1377
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1378
1378
------
1379
1379
int abc(char c, ...); // one required parameter: c
1380
1380
int def(...); // ok
@@ -1416,7 +1416,7 @@ void foo(int x, int y, ...)
1416
1416
$(D _arguments) gives the number of arguments and the type
1417
1417
of each, enabling type safety to be checked at run time.)
1418
1418
1419
- $(SPEC_RUNNABLE_EXAMPLE
1419
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1420
1420
------
1421
1421
import std.stdio;
1422
1422
import core.vararg;
@@ -1500,7 +1500,7 @@ $(H4 $(LNAME2 typesafe_variadic_functions, Typesafe Variadic Functions))
1500
1500
1501
1501
$(P For arrays:)
1502
1502
1503
- $(SPEC_RUNNABLE_EXAMPLE
1503
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1504
1504
------
1505
1505
int main()
1506
1506
{
@@ -1681,7 +1681,7 @@ $(H3 $(LEGACY_LNAME2 Local Static Variables, local-static-variables, Local Stati
1681
1681
As such, their value persists beyond the exit of the function.
1682
1682
)
1683
1683
1684
- $(SPEC_RUNNABLE_EXAMPLE
1684
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1685
1685
---
1686
1686
void foo()
1687
1687
{
@@ -1717,7 +1717,7 @@ $(H2 $(LNAME2 nested, Nested Functions))
1717
1717
1718
1718
$(P Functions may be nested within other functions:)
1719
1719
1720
- $(SPEC_RUNNABLE_EXAMPLE
1720
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1721
1721
------
1722
1722
int bar(int a)
1723
1723
{
@@ -1789,7 +1789,7 @@ void test()
1789
1789
This access includes both the ability to read and write them.
1790
1790
)
1791
1791
1792
- $(SPEC_RUNNABLE_EXAMPLE
1792
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1793
1793
------
1794
1794
int bar(int a)
1795
1795
{
@@ -1815,7 +1815,7 @@ void test()
1815
1815
1816
1816
$(P This access can span multiple nesting levels:)
1817
1817
1818
- $(SPEC_RUNNABLE_EXAMPLE
1818
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1819
1819
------
1820
1820
int bar(int a)
1821
1821
{
@@ -1857,7 +1857,7 @@ int bar(int a)
1857
1857
1858
1858
$(P Functions can be nested within member functions:)
1859
1859
1860
- $(SPEC_RUNNABLE_EXAMPLE
1860
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1861
1861
------
1862
1862
struct Foo
1863
1863
{
@@ -1915,7 +1915,7 @@ void test()
1915
1915
$(LI Declare one or more of the functions to be function templates
1916
1916
even if they take no specific template arguments:)
1917
1917
1918
- $(SPEC_RUNNABLE_EXAMPLE
1918
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1919
1919
------
1920
1920
void test()
1921
1921
{
@@ -1927,7 +1927,7 @@ void test()
1927
1927
1928
1928
$(LI Declare the functions inside of a mixin template:)
1929
1929
1930
- $(SPEC_RUNNABLE_EXAMPLE
1930
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1931
1931
------
1932
1932
mixin template T()
1933
1933
{
@@ -1944,7 +1944,7 @@ void main()
1944
1944
1945
1945
$(LI Use a delegate:)
1946
1946
1947
- $(SPEC_RUNNABLE_EXAMPLE
1947
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1948
1948
------
1949
1949
void test()
1950
1950
{
@@ -1964,7 +1964,7 @@ $(H2 $(LNAME2 closures, Delegates, Function Pointers, and Closures))
1964
1964
1965
1965
$(P A function pointer can point to a static nested function:)
1966
1966
1967
- $(SPEC_RUNNABLE_EXAMPLE
1967
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1968
1968
------
1969
1969
int function() fp;
1970
1970
@@ -1989,7 +1989,7 @@ void bar()
1989
1989
distinct function pointer values. The compiler is free to merge
1990
1990
functions bodies into one if they compile to identical code.)
1991
1991
1992
- $(SPEC_RUNNABLE_EXAMPLE
1992
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
1993
1993
------
1994
1994
int abc(int x) { return x + 1; }
1995
1995
int def(int y) { return y + 1; }
@@ -2003,7 +2003,7 @@ int delegate(int) fp2 = &def;
2003
2003
2004
2004
$(P A delegate can be set to a non-static nested function:)
2005
2005
2006
- $(SPEC_RUNNABLE_EXAMPLE
2006
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
2007
2007
------
2008
2008
int delegate() dg;
2009
2009
@@ -2047,7 +2047,7 @@ int* bar()
2047
2047
the same type:
2048
2048
)
2049
2049
2050
- $(SPEC_RUNNABLE_EXAMPLE
2050
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
2051
2051
------
2052
2052
struct Foo
2053
2053
{
@@ -2118,7 +2118,7 @@ $(H2 $(LNAME2 function-templates, Function Templates))
2118
2118
For example:
2119
2119
)
2120
2120
2121
- $(SPEC_RUNNABLE_EXAMPLE
2121
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
2122
2122
---
2123
2123
// Only one copy of func needs to be written
2124
2124
void func(T)(T x)
@@ -2260,7 +2260,7 @@ static assert(countTen(12) == 12); // invalid, modifies y.
2260
2260
$(LI argument for a template value parameter)
2261
2261
)
2262
2262
2263
- $(SPEC_RUNNABLE_EXAMPLE
2263
+ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
2264
2264
---
2265
2265
template eval( A... )
2266
2266
{
0 commit comments