File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -735,26 +735,41 @@ $(SPEC_RUNNABLE_EXAMPLE_COMPILE
735
735
---
736
736
int sum(int x, int y) pure nothrow { return x + y; }
737
737
738
- // prints ("pure", "nothrow", "@system")
739
738
pragma(msg, __traits(getFunctionAttributes, sum));
740
739
741
740
struct S
742
741
{
743
742
void test() const @system { }
744
743
}
745
744
746
- // prints ("const", "@system")
747
745
pragma(msg, __traits(getFunctionAttributes, S.test));
746
+
747
+ void main(){}
748
748
---
749
+ )
750
+
751
+ Prints:
752
+
753
+ $(CONSOLE
754
+ tuple("pure", "nothrow", "@system")
755
+ tuple("const", "@system")
749
756
)
750
757
751
758
$(P Note that some attributes can be inferred. For example:)
752
759
753
760
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
754
761
---
755
- // prints ("pure", "nothrow", "@nogc", "@trusted")
756
762
pragma(msg, __traits(getFunctionAttributes, (int x) @trusted { return x * 2; }));
763
+
764
+ void main(){}
757
765
---
766
+ )
767
+
768
+ Prints:
769
+
770
+ $(CONSOLE
771
+ tuple("pure", "nothrow", "@nogc", "@trusted")
772
+ )
758
773
)
759
774
)
760
775
You can’t perform that action at this time.
0 commit comments