// Build don't link: // Copyright (C) 1999 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 12 Dec 1999 // static_cast should not cast _away_ constness ([expr.static.cast]/6), // but nothing bans _adding_ constness. [expr.static.cast]/10 states that a // pointer of type cv void can be cast to pointer to object type. struct X; struct Y {}; struct Z : Y {}; void fn (void *p, void const *cp, Y *yp, Y const *ycp, Z *zp, Z const *zcp) { static_cast (p); static_cast (p); static_cast (p); static_cast (p); static_cast (p); static_cast (p); static_cast (p); static_cast (p); static_cast (cp); // ERROR - lose const static_cast (cp); static_cast (cp); // ERROR - lose const static_cast (cp); static_cast (cp); // ERROR - lose const static_cast (cp); // ERROR - lose const static_cast (cp); static_cast (cp); static_cast (yp); static_cast (yp); static_cast (ycp); // ERROR - lose const static_cast (ycp); static_cast (zp); static_cast (zp); static_cast (zcp); // ERROR - lose const static_cast (zcp); }