mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00

Show operation. Use 'is not defined' for aggregate types. Part of Issue 13718 - unary minus on number literals has lower precedence than UFCS.
20 lines
270 B
D
20 lines
270 B
D
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/operator_undefined.d(19): Error: operator `-` is not defined for `toJson(2)` of type `Json`
|
|
---
|
|
*/
|
|
|
|
import std.stdio;
|
|
|
|
struct Json
|
|
{
|
|
//int opUnary(string op : "-")();
|
|
}
|
|
|
|
Json toJson(int);
|
|
|
|
void main()
|
|
{
|
|
auto x = -2.toJson;
|
|
}
|