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