gcc/testsuite/gdc.test/fail_compilation/operator_undefined.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/operator_undefined.d(20): Error: operator `-` is not defined for `Json` |
| 5 | fail_compilation/operator_undefined.d(11): perhaps overload the operator with `auto opUnary(string op : "-")() {}` |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | import std.stdio; |
| 10 | |
| 11 | struct Json |
| 12 | { |
| 13 | //int opUnary(string op : "-")(); |
| 14 | } |
| 15 | |
| 16 | Json toJson(int); |
| 17 | |
| 18 | void main() |
| 19 | { |
| 20 | auto x = -2.toJson; |
| 21 | } |