gcc/testsuite/gdc.dg/pr95250.d
raw| 1 | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95250 |
| 2 | // { dg-do compile } |
| 3 | |
| 4 | template Unsigned(T) |
| 5 | { |
| 6 | static assert(false, "Type " ~ T.stringof ~ |
| 7 | " does not have an Unsigned counterpart"); |
| 8 | } |
| 9 | |
| 10 | |
| 11 | void* f(T)(T a, T b) |
| 12 | { |
| 13 | alias UnsignedVoid = Unsigned!(T); |
| 14 | return cast(T)(cast(T)(cast(UnsignedVoid)(a-b) / 2)); |
| 15 | } |
| 16 | |
| 17 | static assert(is(typeof(f!(void*)(null, null)) == void*)); |
| 18 | // { dg-error "static assert: \(.*\) is false" "" { target *-*-* } .-1 } |