1 //
2 //
3 // this file is auto generated by constants-gen/generator.d, do not edit manually.
4 //
5 //
6 
7 module dcd.common.constants2;
8 
9 import dcd.common.constants : ConstantCompletion;
10 
11 /**
12  * Pragma arguments
13  */
14 immutable ConstantCompletion[] pragmas = [
15 	// generated from pragma.dd
16 	ConstantCompletion("inline", `$(P Affects whether functions are inlined or not. If at the declaration level, it
17  affects the functions declared in the block it controls. If inside a function, it
18  affects the function it is enclosed by. If there are multiple pragma inlines in a function,
19  the lexically last one takes effect.)
20 
21  $(P It takes three forms:)
22  $(OL
23     $(LI
24 ---
25 pragma(inline)
26 ---
27     Sets the behavior to match the default behavior set by the compiler switch
28     $(DDSUBLINK dmd, switch-inline, $(TT -inline)).
29     )
30     $(LI
31 ---
32 pragma(inline, false)
33 ---
34     Functions are never inlined.
35     )
36     $(LI
37 ---
38 pragma(inline, true)
39 ---
40     If a function cannot be inlined with the $(DDSUBLINK dmd, switch-inline, $(TT -inline))
41     switch, an error message is issued. This is expected to be improved in the future to causing
42     functions to always be inlined regardless of compiler switch settings. Whether a compiler can
43     inline a particular function or not is implementation defined.
44     )
45   )
46 ---
47 pragma(inline):
48 int foo(int x) // foo() is never inlined
49 {
50     pragma(inline, true);
51     ++x;
52     pragma(inline, false); // supercedes the others
53     return x + 3;
54 }
55 ---`),
56 	ConstantCompletion("lib", `Inserts a directive in the object file to link in the library
57     specified by the $(ASSIGNEXPRESSION).
58     The $(ASSIGNEXPRESSION)s must be a string literal:
59 -----------------
60 pragma(lib, "foo.lib");
61 -----------------`),
62 	ConstantCompletion("mangle", `Overrides the default mangling for a symbol. It's only effective
63     when the symbol is a function declaration or a variable declaration.
64     For example this allows linking to a symbol which is a D keyword, which would normally
65     be disallowed as a symbol name:
66 -----------------
67 pragma(mangle, "body")
68 extern(C) void body_func();
69 -----------------`),
70 	ConstantCompletion("msg", `Constructs a message from the arguments and prints to the standard error stream while compiling:
71 -----------------
72 pragma(msg, "compiling...", 1, 1.0);
73 -----------------`),
74 	ConstantCompletion("startaddress", `Puts a directive into the object file saying that the
75     function specified in the first argument will be the
76     start address for the program:
77 -----------------
78 void foo() { ... }
79 pragma(startaddress, foo);
80 -----------------
81     This is not normally used for application level programming,
82     but is for specialized systems work.
83     For applications code, the start address is taken care of
84     by the runtime library.
85 )
86 )
87 
88 $(H2 $(LNAME2 vendor_specific_pragmas, Vendor Specific Pragmas))
89 
90     $(P Vendor specific pragma $(I Identifier)s can be defined if they
91     are prefixed by the vendor's trademarked name, in a similar manner
92     to version identifiers:
93     )
94 
95 -----------------
96 pragma(DigitalMars_funky_extension) { ... }
97 -----------------
98 
99     $(P Compilers must diagnose an error for unrecognized $(I Pragma)s,
100     even if they are vendor specific ones. This implies that vendor
101     specific pragmas should be wrapped in version statements:
102     )
103 
104 -----------------
105 version (DigitalMars)
106 {
107     pragma(DigitalMars_funky_extension)
108     { ... }
109 }
110 -----------------`),
111 ];
112 
113 /**
114  * Traits arguments
115  */
116 immutable ConstantCompletion[] traits = [
117 	// generated from traits.dd
118 	ConstantCompletion("allMembers", `$(P Takes a single argument, which must evaluate to either
119 a type or an expression of type.
120 A tuple of string literals is returned, each of which
121 is the name of a member of that type combined with all
122 of the members of the base classes (if the type is a class).
123 No name is repeated.
124 Builtin properties are not included.
125 )
126 
127 ---
128 import std.stdio;
129 
130 class D
131 {
132     this() { }
133     ~this() { }
134     void foo() { }
135     int foo(int) { return 0; }
136 }
137 
138 void main()
139 {
140     auto b = [ __traits(allMembers, D) ];
141     writeln(b);
142     // ["__ctor", "__dtor", "foo", "toString", "toHash", "opCmp", "opEquals",
143     // "Monitor", "factory"]
144 }
145 ---
146 
147 $(P The order in which the strings appear in the result
148 is not defined.)`),
149 	ConstantCompletion("classInstanceSize", `$(P Takes a single argument, which must evaluate to either
150 a class type or an expression of class type.
151 The result
152 is of type $(CODE size_t), and the value is the number of
153 bytes in the runtime instance of the class type.
154 It is based on the static type of a class, not the
155 polymorphic type.
156 )`),
157 	ConstantCompletion("compiles", `$(P Returns a bool $(D true) if all of the arguments
158 compile (are semantically correct).
159 The arguments can be symbols, types, or expressions that
160 are syntactically correct.
161 The arguments cannot be statements or declarations.
162 )
163 
164 $(P If there are no arguments, the result is $(D false).)
165 
166 ---
167 import std.stdio;
168 
169 struct S
170 {
171     static int s1;
172     int s2;
173 }
174 
175 int foo();
176 int bar();
177 
178 void main()
179 {
180     writeln(__traits(compiles));                      // false
181     writeln(__traits(compiles, foo));                 // true
182     writeln(__traits(compiles, foo + 1));             // true
183     writeln(__traits(compiles, &foo + 1));            // false
184     writeln(__traits(compiles, typeof(1)));           // true
185     writeln(__traits(compiles, S.s1));                // true
186     writeln(__traits(compiles, S.s3));                // false
187     writeln(__traits(compiles, 1,2,3,int,long,std));  // true
188     writeln(__traits(compiles, 3[1]));                // false
189     writeln(__traits(compiles, 1,2,3,int,long,3[1])); // false
190 }
191 ---
192 
193 $(P This is useful for:)
194 
195 $(UL
196 $(LI Giving better error messages inside generic code than
197 the sometimes hard to follow compiler ones.)
198 $(LI Doing a finer grained specialization than template
199 partial specialization allows for.)
200 )
201 
202 
203 $(H2 $(LNAME2 specialkeywords, Special Keywords))
204 
205     $(P $(CODE __FILE__) and $(CODE __LINE__) expand to the source
206     file name and line number at the point of instantiation. The path of
207     the source file is left up to the compiler. )
208 
209     $(P $(CODE __FILE_FULL_PATH__) expands to the absolute source
210     file name at the point of instantiation.)
211 
212     $(P $(CODE __MODULE__) expands to the module name at the point of
213     instantiation.)
214 
215     $(P $(CODE __FUNCTION__) expands to the fully qualified name of the
216     function at the point of instantiation.)
217 
218     $(P $(CODE __PRETTY_FUNCTION__) is similar to $(CODE __FUNCTION__),
219     but also expands the function return type, its parameter types,
220     and its attributes.)
221 
222     $(P Example usage:)
223 
224 -----
225 module test;
226 import std.stdio;
227 
228 void test(string file = __FILE__, size_t line = __LINE__,
229         string mod = __MODULE__, string func = __FUNCTION__,
230         string pretty = __PRETTY_FUNCTION__,
231         string fileFullPath = __FILE_FULL_PATH__)
232 {
233     writefln("file: '%s', line: '%s', module: '%s',\nfunction: '%s', " ~
234         "pretty function: '%s',\nfile full path: '%s'",
235         file, line, mod, func, pretty, fileFullPath);
236 }
237 
238 int main(string[] args)
239 {
240     test();
241     return 0;
242 }
243 -----
244 
245 $(P Assuming the file was at /example/test.d, this will output:)
246 
247 $(CONSOLE
248 file: 'test.d', line: '13', module: 'test',
249 function: 'test.main', pretty function: 'int test.main(string[] args)',
250 file full path: '/example/test.d'
251 )`),
252 	ConstantCompletion("derivedMembers", `$(P Takes a single argument, which must evaluate to either
253 a type or an expression of type.
254 A tuple of string literals is returned, each of which
255 is the name of a member of that type.
256 No name is repeated.
257 Base class member names are not included.
258 Builtin properties are not included.
259 )
260 
261 ---
262 import std.stdio;
263 
264 class D
265 {
266     this() { }
267     ~this() { }
268     void foo() { }
269     int foo(int) { return 0; }
270 }
271 
272 void main()
273 {
274     auto a = [__traits(derivedMembers, D)];
275     writeln(a);    // ["__ctor", "__dtor", "foo"]
276 }
277 ---
278 
279 $(P The order in which the strings appear in the result
280 is not defined.)`),
281 	ConstantCompletion("getAliasThis", `$(P Takes one argument, a symbol of aggregate type.
282     If the given aggregate type has $(D alias this), returns a list of
283     $(D alias this) names, by a tuple of $(D string)s.
284     Otherwise returns an empty tuple.
285 )`),
286 	ConstantCompletion("getAttributes", `$(P
287     Takes one argument, a symbol. Returns a tuple of all attached user-defined attributes.
288     If no UDA's exist it will return an empty tuple.
289 )
290 
291 $(P
292     For more information, see: $(DDSUBLINK spec/attribute, uda, User-Defined Attributes)
293 )
294 
295 ---
296 @(3) int a;
297 @("string", 7) int b;
298 
299 enum Foo;
300 @Foo int c;
301 
302 pragma(msg, __traits(getAttributes, a));
303 pragma(msg, __traits(getAttributes, b));
304 pragma(msg, __traits(getAttributes, c));
305 ---
306 
307     Prints:
308 
309 $(CONSOLE
310 tuple(3)
311 tuple("string", 7)
312 tuple((Foo))
313 )
314 )`),
315 	ConstantCompletion("getFunctionAttributes", `$(P
316     Takes one argument which must either be a function symbol, function literal,
317     or a function pointer. It returns a string tuple of all the attributes of
318     that function $(B excluding) any user-defined attributes (UDAs can be
319     retrieved with the $(RELATIVE_LINK2 get-attributes, getAttributes) trait).
320     If no attributes exist it will return an empty tuple.
321 )
322 
323 
324     $(B Note:) The order of the attributes in the returned tuple is
325     implementation-defined and should not be relied upon.
326 
327     $(P
328         A list of currently supported attributes are:)
329         $(UL $(LI $(D pure), $(D nothrow), $(D @nogc), $(D @property), $(D @system), $(D @trusted), $(D @safe), and $(D ref)))
330         $(B Note:) $(D ref) is a function attribute even though it applies to the return type.
331 
332     $(P
333         Additionally the following attributes are only valid for non-static member functions:)
334         $(UL $(LI $(D const), $(D immutable), $(D inout), $(D shared)))
335 
336 For example:
337 
338 ---
339 int sum(int x, int y) pure nothrow { return x + y; }
340 
341 // prints ("pure", "nothrow", "@system")
342 pragma(msg, __traits(getFunctionAttributes, sum));
343 
344 struct S
345 {
346     void test() const @system { }
347 }
348 
349 // prints ("const", "@system")
350 pragma(msg, __traits(getFunctionAttributes, S.test));
351 ---
352 
353 $(P Note that some attributes can be inferred. For example:)
354 
355 ---
356 // prints ("pure", "nothrow", "@nogc", "@trusted")
357 pragma(msg, __traits(getFunctionAttributes, (int x) @trusted { return x * 2; }));
358 ---
359 )`),
360 	ConstantCompletion("getFunctionVariadicStyle", `$(P
361     Takes one argument which must either be a function symbol, or a type
362     that is a function, delegate or a function pointer.
363     It returns a string identifying the kind of
364     $(LINK2 function.html#variadic, variadic arguments) that are supported.
365 )
366 
367 $(TABLE2 getFunctionVariadicStyle,
368     $(THEAD result, kind, access, example)
369     $(TROW $(D "none"), not a variadic function, $(NBSP), $(D void foo();))
370     $(TROW $(D "argptr"), D style variadic function, $(D _argptr) and $(D _arguments), $(D void bar(...)))
371     $(TROW $(D "stdarg"), C style variadic function, $(LINK2 $(ROOT_DIR)phobos/core_stdc_stdarg.html, $(D core.stdc.stdarg)), $(D extern (C) void abc(int, ...)))
372     $(TROW $(D "typesafe"), typesafe variadic function, array on stack, $(D void def(int[] ...)))
373 )
374 
375 ---
376 import core.stdc.stdarg;
377 
378 void novar() {}
379 extern(C) void cstyle(int, ...) {}
380 extern(C++) void cppstyle(int, ...) {}
381 void dstyle(...) {}
382 void typesafe(int[]...) {}
383 
384 static assert(__traits(getFunctionVariadicStyle, novar) == "none");
385 static assert(__traits(getFunctionVariadicStyle, cstyle) == "stdarg");
386 static assert(__traits(getFunctionVariadicStyle, cppstyle) == "stdarg");
387 static assert(__traits(getFunctionVariadicStyle, dstyle) == "argptr");
388 static assert(__traits(getFunctionVariadicStyle, typesafe) == "typesafe");
389 
390 static assert(__traits(getFunctionVariadicStyle, (int[] a...) {}) == "typesafe");
391 static assert(__traits(getFunctionVariadicStyle, typeof(cstyle)) == "stdarg");
392 ---
393 )`),
394 	ConstantCompletion("getLinkage", `$(P Takes one argument, which is a declaration symbol, or the type of a function,
395 delegate, or pointer to function.
396 Returns a string representing the $(LINK2 attribute.html#LinkageAttribute, LinkageAttribute)
397 of the declaration.
398 The string is one of:
399 )
400 
401 $(UL
402 $(LI $(D "D"))
403 $(LI $(D "C"))
404 $(LI $(D "C++"))
405 $(LI $(D "Windows"))
406 $(LI $(D "Pascal"))
407 $(LI $(D "Objective-C"))
408 $(LI $(D "System"))
409 )
410 
411 ---
412 extern (C) int fooc();
413 alias aliasc = fooc;
414 
415 static assert(__traits(getLinkage, fooc) == "C");
416 static assert(__traits(getLinkage, aliasc) == "C");
417 ---`),
418 	ConstantCompletion("getMember", `$(P Takes two arguments, the second must be a string.
419 The result is an expression formed from the first
420 argument, followed by a $(SINGLEQUOTE .), followed by the second
421 argument as an identifier.
422 )
423 
424 ---
425 import std.stdio;
426 
427 struct S
428 {
429     int mx;
430     static int my;
431 }
432 
433 void main()
434 {
435     S s;
436 
437     __traits(getMember, s, "mx") = 1;  // same as s.mx=1;
438     writeln(__traits(getMember, s, "m" ~ "x")); // 1
439 
440     __traits(getMember, S, "mx") = 1;  // error, no this for S.mx
441     __traits(getMember, S, "my") = 2;  // ok
442 }
443 ---`),
444 	ConstantCompletion("getOverloads", `$(P The first argument is an aggregate (e.g. struct/class/module).
445 The second argument is a string that matches the name of
446 one of the functions in that aggregate.
447 The result is a tuple of all the overloads of that function.
448 )
449 
450 ---
451 import std.stdio;
452 
453 class D
454 {
455     this() { }
456     ~this() { }
457     void foo() { }
458     int foo(int) { return 2; }
459 }
460 
461 void main()
462 {
463     D d = new D();
464 
465     foreach (t; __traits(getOverloads, D, "foo"))
466         writeln(typeid(typeof(t)));
467 
468     alias b = typeof(__traits(getOverloads, D, "foo"));
469     foreach (t; b)
470         writeln(typeid(t));
471 
472     auto i = __traits(getOverloads, d, "foo")[1](1);
473     writeln(i);
474 }
475 ---
476 
477 Prints:
478 
479 $(CONSOLE
480 void()
481 int()
482 void()
483 int()
484 2
485 )`),
486 	ConstantCompletion("getParameterStorageClasses", `$(P
487     Takes two arguments.
488     The first must either be a function symbol, or a type
489     that is a function, delegate or a function pointer.
490     The second is an integer identifying which parameter, where the first parameter is
491     0.
492     It returns a tuple of strings representing the storage classes of that parameter.
493 )
494 
495 ---
496 ref int foo(return ref const int* p, scope int* a, out int b, lazy int c);
497 
498 static assert(__traits(getParameterStorageClasses, foo, 0)[0] == "return");
499 static assert(__traits(getParameterStorageClasses, foo, 0)[1] == "ref");
500 
501 static assert(__traits(getParameterStorageClasses, foo, 1)[0] == "scope");
502 static assert(__traits(getParameterStorageClasses, foo, 2)[0] == "out");
503 static assert(__traits(getParameterStorageClasses, typeof(&foo), 3)[0] == "lazy");
504 ---`),
505 	ConstantCompletion("getPointerBitmap", `$(P The argument is a type.
506 The result is an array of $(D size_t) describing the memory used by an instance of the given type.
507 )
508 $(P The first element of the array is the size of the type (for classes it is
509 the $(GBLINK classInstanceSize)).)
510 $(P The following elements describe the locations of GC managed pointers within the
511 memory occupied by an instance of the type.
512 For type T, there are $(D T.sizeof / size_t.sizeof) possible pointers represented
513 by the bits of the array values.)
514 $(P This array can be used by a precise GC to avoid false pointers.)
515 ---
516 class C
517 {
518     // implicit virtual function table pointer not marked
519     // implicit monitor field not marked, usually managed manually
520     C next;
521     size_t sz;
522     void* p;
523     void function () fn; // not a GC managed pointer
524 }
525 
526 struct S
527 {
528     size_t val1;
529     void* p;
530     C c;
531     byte[] arr;          // { length, ptr }
532     void delegate () dg; // { context, func }
533 }
534 
535 static assert (__traits(getPointerBitmap, C) == [6*size_t.sizeof, 0b010100]);
536 static assert (__traits(getPointerBitmap, S) == [7*size_t.sizeof, 0b0110110]);
537 ---`),
538 	ConstantCompletion("getProtection", `$(P The argument is a symbol.
539 The result is a string giving its protection level: "public", "private", "protected", "export", or "package".
540 )
541 
542 ---
543 import std.stdio;
544 
545 class D
546 {
547     export void foo() { }
548     public int bar;
549 }
550 
551 void main()
552 {
553     D d = new D();
554 
555     auto i = __traits(getProtection, d.foo);
556     writeln(i);
557 
558     auto j = __traits(getProtection, d.bar);
559     writeln(j);
560 }
561 ---
562 
563 Prints:
564 
565 $(CONSOLE
566 export
567 public
568 )`),
569 	ConstantCompletion("getUnitTests", `$(P
570         Takes one argument, a symbol of an aggregate (e.g. struct/class/module).
571         The result is a tuple of all the unit test functions of that aggregate.
572         The functions returned are like normal nested static functions,
573         $(DDSUBLINK glossary, ctfe, CTFE) will work and
574         $(DDSUBLINK spec/attribute, uda, UDA's) will be accessible.
575 )
576 
577 $(H3 Note:)
578 
579 $(P
580         The -unittest flag needs to be passed to the compiler. If the flag
581         is not passed $(CODE __traits(getUnitTests)) will always return an
582         empty tuple.
583 )
584 
585 ---
586 module foo;
587 
588 import core.runtime;
589 import std.stdio;
590 
591 struct name { string name; }
592 
593 class Foo
594 {
595     unittest
596     {
597         writeln("foo.Foo.unittest");
598     }
599 }
600 
601 @name("foo") unittest
602 {
603     writeln("foo.unittest");
604 }
605 
606 template Tuple (T...)
607 {
608     alias Tuple = T;
609 }
610 
611 shared static this()
612 {
613   // Override the default unit test runner to do nothing. After that, "main" will
614   // be called.
615   Runtime.moduleUnitTester = { return true; };
616 }
617 
618 void main()
619 {
620     writeln("start main");
621 
622     alias tests = Tuple!(__traits(getUnitTests, foo));
623     static assert(tests.length == 1);
624 
625     alias attributes = Tuple!(__traits(getAttributes, tests[0]));
626     static assert(attributes.length == 1);
627 
628     foreach (test; tests)
629         test();
630 
631     foreach (test; __traits(getUnitTests, Foo))
632         test();
633 }
634 ---
635 
636 $(P By default, the above will print:)
637 
638 $(CONSOLE
639 start main
640 foo.unittest
641 foo.Foo.unittest
642 )`),
643 	ConstantCompletion("getVirtualFunctions", `$(P The same as $(GLINK getVirtualMethods), except that
644 final functions that do not override anything are included.
645 )`),
646 	ConstantCompletion("getVirtualIndex", `$(P Takes a single argument which must evaluate to a function.
647 The result is a $(CODE ptrdiff_t) containing the index
648 of that function within the vtable of the parent type.
649 If the function passed in is final and does not override
650 a virtual function, $(D -1) is returned instead.
651 )`),
652 	ConstantCompletion("getVirtualMethods", `$(P The first argument is a class type or an expression of
653 class type.
654 The second argument is a string that matches the name of
655 one of the functions of that class.
656 The result is a tuple of the virtual overloads of that function.
657 It does not include final functions that do not override anything.
658 )
659 
660 ---
661 import std.stdio;
662 
663 class D
664 {
665     this() { }
666     ~this() { }
667     void foo() { }
668     int foo(int) { return 2; }
669 }
670 
671 void main()
672 {
673     D d = new D();
674 
675     foreach (t; __traits(getVirtualMethods, D, "foo"))
676         writeln(typeid(typeof(t)));
677 
678     alias b = typeof(__traits(getVirtualMethods, D, "foo"));
679     foreach (t; b)
680         writeln(typeid(t));
681 
682     auto i = __traits(getVirtualMethods, d, "foo")[1](1);
683     writeln(i);
684 }
685 ---
686 
687 Prints:
688 
689 $(CONSOLE
690 void()
691 int()
692 void()
693 int()
694 2
695 )`),
696 	ConstantCompletion("hasMember", `$(P The first argument is a type that has members, or
697 is an expression of a type that has members.
698 The second argument is a string.
699 If the string is a valid property of the type,
700 $(D true) is returned, otherwise $(D false).
701 )
702 
703 ---
704 import std.stdio;
705 
706 struct S
707 {
708     int m;
709 }
710 
711 void main()
712 {
713     S s;
714 
715     writeln(__traits(hasMember, S, "m")); // true
716     writeln(__traits(hasMember, s, "m")); // true
717     writeln(__traits(hasMember, S, "y")); // false
718     writeln(__traits(hasMember, int, "sizeof")); // true
719 }
720 ---`),
721 	ConstantCompletion("identifier", `$(P Takes one argument, a symbol. Returns the identifier
722 for that symbol as a string literal.
723 )
724 ---
725 import std.stdio;
726 
727 int var = 123;
728 pragma(msg, typeof(var));                       // int
729 pragma(msg, typeof(__traits(identifier, var))); // string
730 writeln(var);                                   // 123
731 writeln(__traits(identifier, var));             // "var"
732 ---`),
733 	ConstantCompletion("isAbstractClass", `$(P If the arguments are all either types that are abstract classes,
734 or expressions that are typed as abstract classes, then $(D true)
735 is returned.
736 Otherwise, $(D false) is returned.
737 If there are no arguments, $(D false) is returned.)
738 
739 ---
740 import std.stdio;
741 
742 abstract class C { int foo(); }
743 
744 void main()
745 {
746     C c;
747     writeln(__traits(isAbstractClass, C));
748     writeln(__traits(isAbstractClass, c, C));
749     writeln(__traits(isAbstractClass));
750     writeln(__traits(isAbstractClass, int*));
751 }
752 ---
753 
754 Prints:
755 
756 $(CONSOLE
757 true
758 true
759 false
760 false
761 )`),
762 	ConstantCompletion("isAbstractFunction", `$(P Takes one argument. If that argument is an abstract function,
763 $(D true) is returned, otherwise $(D false).
764 )
765 
766 ---
767 import std.stdio;
768 
769 struct S
770 {
771     void bar() { }
772 }
773 
774 class C
775 {
776     void bar() { }
777 }
778 
779 class AC
780 {
781     abstract void foo();
782 }
783 
784 void main()
785 {
786     writeln(__traits(isAbstractFunction, C.bar));   // false
787     writeln(__traits(isAbstractFunction, S.bar));   // false
788     writeln(__traits(isAbstractFunction, AC.foo));  // true
789 }
790 ---`),
791 	ConstantCompletion("isArithmetic", `$(P If the arguments are all either types that are arithmetic types,
792 or expressions that are typed as arithmetic types, then $(D true)
793 is returned.
794 Otherwise, $(D false) is returned.
795 If there are no arguments, $(D false) is returned.)
796 
797 ---
798 import std.stdio;
799 
800 void main()
801 {
802     int i;
803     writeln(__traits(isArithmetic, int));
804     writeln(__traits(isArithmetic, i, i+1, int));
805     writeln(__traits(isArithmetic));
806     writeln(__traits(isArithmetic, int*));
807 }
808 ---
809 
810 Prints:
811 
812 $(CONSOLE
813 true
814 true
815 false
816 false
817 )`),
818 	ConstantCompletion("isAssociativeArray", `$(P Works like $(D isArithmetic), except it's for associative array
819 types.)`),
820 	ConstantCompletion("isDeprecated", `$(P Takes one argument. It returns ` ~ "`" ~ `true` ~ "`" ~ ` if the argument is a symbol
821 marked with the ` ~ "`" ~ `deprecated` ~ "`" ~ ` keyword, otherwise ` ~ "`" ~ `false` ~ "`" ~ `.)`),
822 	ConstantCompletion("isDisabled", `$(P Takes one argument and returns ` ~ "`" ~ `true` ~ "`" ~ ` if it's a function declaration
823 marked with ` ~ "`" ~ `@disable` ~ "`" ~ `.)
824 
825 ---
826 struct Foo
827 {
828     @disable void foo();
829     void bar(){}
830 }
831 
832 static assert(__traits(isDisabled, Foo.foo));
833 static assert(!__traits(isDisabled, Foo.bar));
834 ---
835 
836 $(P For any other declaration even if ` ~ "`" ~ `@disable` ~ "`" ~ ` is a syntactically valid
837 attribute ` ~ "`" ~ `false` ~ "`" ~ ` is returned because the annotation has no effect.)
838 
839 ---
840 @disable struct Bar{}
841 
842 static assert(!__traits(isDisabled, Bar));
843 ---`),
844 	ConstantCompletion("isFinalClass", `$(P Works like $(D isAbstractClass), except it's for final
845 classes.)`),
846 	ConstantCompletion("isFinalFunction", `$(P Takes one argument. If that argument is a final function,
847 $(D true) is returned, otherwise $(D false).
848 )
849 
850 ---
851 import std.stdio;
852 
853 struct S
854 {
855     void bar() { }
856 }
857 
858 class C
859 {
860     void bar() { }
861     final void foo();
862 }
863 
864 final class FC
865 {
866     void foo();
867 }
868 
869 void main()
870 {
871     writeln(__traits(isFinalFunction, C.bar));  // false
872     writeln(__traits(isFinalFunction, S.bar));  // false
873     writeln(__traits(isFinalFunction, C.foo));  // true
874     writeln(__traits(isFinalFunction, FC.foo)); // true
875 }
876 ---`),
877 	ConstantCompletion("isFloating", `$(P Works like $(D isArithmetic), except it's for floating
878 point types (including imaginary and complex types).)`),
879 	ConstantCompletion("isFuture", `$(P Takes one argument. It returns ` ~ "`" ~ `true` ~ "`" ~ ` if the argument is a symbol
880 marked with the ` ~ "`" ~ `@future` ~ "`" ~ ` keyword, otherwise ` ~ "`" ~ `false` ~ "`" ~ `. Currently, only
881 functions and variable declarations have support for the ` ~ "`" ~ `@future` ~ "`" ~ ` keyword.)`),
882 	ConstantCompletion("isIntegral", `$(P Works like $(D isArithmetic), except it's for integral
883 types (including character types).)`),
884 	ConstantCompletion("isLazy", `$(P Takes one argument. If that argument is a declaration,
885 $(D true) is returned if it is $(D_KEYWORD ref), $(D_KEYWORD out),
886 or $(D_KEYWORD lazy), otherwise $(D false).
887 )
888 
889 ---
890 void fooref(ref int x)
891 {
892     static assert(__traits(isRef, x));
893     static assert(!__traits(isOut, x));
894     static assert(!__traits(isLazy, x));
895 }
896 
897 void fooout(out int x)
898 {
899     static assert(!__traits(isRef, x));
900     static assert(__traits(isOut, x));
901     static assert(!__traits(isLazy, x));
902 }
903 
904 void foolazy(lazy int x)
905 {
906     static assert(!__traits(isRef, x));
907     static assert(!__traits(isOut, x));
908     static assert(__traits(isLazy, x));
909 }
910 ---`),
911 	ConstantCompletion("isNested", `$(P Takes one argument.
912 It returns $(D true) if the argument is a nested type which internally
913 stores a context pointer, otherwise it returns $(D false).
914 Nested types can be  $(DDSUBLINK spec/class, nested, classes),
915 $(DDSUBLINK spec/struct, nested, structs), and
916 $(DDSUBLINK spec/function, variadicnested, functions).)`),
917 	ConstantCompletion("isOut", `$(P Takes one argument. If that argument is a declaration,
918 $(D true) is returned if it is $(D_KEYWORD ref), $(D_KEYWORD out),
919 or $(D_KEYWORD lazy), otherwise $(D false).
920 )
921 
922 ---
923 void fooref(ref int x)
924 {
925     static assert(__traits(isRef, x));
926     static assert(!__traits(isOut, x));
927     static assert(!__traits(isLazy, x));
928 }
929 
930 void fooout(out int x)
931 {
932     static assert(!__traits(isRef, x));
933     static assert(__traits(isOut, x));
934     static assert(!__traits(isLazy, x));
935 }
936 
937 void foolazy(lazy int x)
938 {
939     static assert(!__traits(isRef, x));
940     static assert(!__traits(isOut, x));
941     static assert(__traits(isLazy, x));
942 }
943 ---`),
944 	ConstantCompletion("isOverrideFunction", `$(P Takes one argument. If that argument is a function marked with
945 $(D_KEYWORD override), $(D true) is returned, otherwise $(D false).
946 )
947 
948 ---
949 import std.stdio;
950 
951 class Base
952 {
953     void foo() { }
954 }
955 
956 class Foo : Base
957 {
958     override void foo() { }
959     void bar() { }
960 }
961 
962 void main()
963 {
964     writeln(__traits(isOverrideFunction, Base.foo)); // false
965     writeln(__traits(isOverrideFunction, Foo.foo));  // true
966     writeln(__traits(isOverrideFunction, Foo.bar));  // false
967 }
968 ---`),
969 	ConstantCompletion("isPOD", `$(P Takes one argument, which must be a type. It returns
970 $(D true) if the type is a $(DDSUBLINK glossary, pod, POD) type, otherwise $(D false).)`),
971 	ConstantCompletion("isRef", `$(P Takes one argument. If that argument is a declaration,
972 $(D true) is returned if it is $(D_KEYWORD ref), $(D_KEYWORD out),
973 or $(D_KEYWORD lazy), otherwise $(D false).
974 )
975 
976 ---
977 void fooref(ref int x)
978 {
979     static assert(__traits(isRef, x));
980     static assert(!__traits(isOut, x));
981     static assert(!__traits(isLazy, x));
982 }
983 
984 void fooout(out int x)
985 {
986     static assert(!__traits(isRef, x));
987     static assert(__traits(isOut, x));
988     static assert(!__traits(isLazy, x));
989 }
990 
991 void foolazy(lazy int x)
992 {
993     static assert(!__traits(isRef, x));
994     static assert(!__traits(isOut, x));
995     static assert(__traits(isLazy, x));
996 }
997 ---`),
998 	ConstantCompletion("isSame", `$(P Takes two arguments and returns bool $(D true) if they
999 are the same symbol, $(D false) if not.)
1000 
1001 ---
1002 import std.stdio;
1003 
1004 struct S { }
1005 
1006 int foo();
1007 int bar();
1008 
1009 void main()
1010 {
1011     writeln(__traits(isSame, foo, foo)); // true
1012     writeln(__traits(isSame, foo, bar)); // false
1013     writeln(__traits(isSame, foo, S));   // false
1014     writeln(__traits(isSame, S, S));     // true
1015     writeln(__traits(isSame, std, S));   // false
1016     writeln(__traits(isSame, std, std)); // true
1017 }
1018 ---
1019 
1020 $(P If the two arguments are expressions made up of literals
1021 or enums that evaluate to the same value, true is returned.)`),
1022 	ConstantCompletion("isScalar", `$(P Works like $(D isArithmetic), except it's for scalar
1023 types.)`),
1024 	ConstantCompletion("isStaticArray", `$(P Works like $(D isArithmetic), except it's for static array
1025 types.)`),
1026 	ConstantCompletion("isStaticFunction", `$(P Takes one argument. If that argument is a static function,
1027 meaning it has no context pointer,
1028 $(D true) is returned, otherwise $(D false).
1029 )`),
1030 	ConstantCompletion("isTemplate", `$(P Takes one argument. If that argument is a template then $(D true) is returned,
1031 otherwise $(D false).
1032 )
1033 
1034 ---
1035 void foo(T)(){}
1036 static assert(__traits(isTemplate,foo));
1037 static assert(!__traits(isTemplate,foo!int()));
1038 static assert(!__traits(isTemplate,"string"));
1039 ---`),
1040 	ConstantCompletion("isUnsigned", `$(P Works like $(D isArithmetic), except it's for unsigned
1041 types.)`),
1042 	ConstantCompletion("isVirtualFunction", `$(P The same as $(GLINK isVirtualMethod), except
1043 that final functions that don't override anything return true.
1044 )`),
1045 	ConstantCompletion("isVirtualMethod", `$(P Takes one argument. If that argument is a virtual function,
1046 $(D true) is returned, otherwise $(D false).
1047 Final functions that don't override anything return false.
1048 )
1049 
1050 ---
1051 import std.stdio;
1052 
1053 struct S
1054 {
1055     void bar() { }
1056 }
1057 
1058 class C
1059 {
1060     void bar() { }
1061 }
1062 
1063 void main()
1064 {
1065     writeln(__traits(isVirtualMethod, C.bar));  // true
1066     writeln(__traits(isVirtualMethod, S.bar));  // false
1067 }
1068 ---`),
1069 	ConstantCompletion("parent", `$(P Takes a single argument which must evaluate to a symbol.
1070 The result is the symbol that is the parent of it.
1071 )`),
1072 ];