8sa1-gcc/gcc/testsuite/g++.old-deja/g++.other/sc1.C
Mark Mitchell af7b990290 typeck.c (build_static_cast): Don't allow static_casts that cast away constness.
* typeck.c (build_static_cast): Don't allow static_casts that cast
	away constness.
	(casts_away_constness_r): New function.
	(casts_away_constness): Likewise.

From-SVN: r27128
1999-05-24 15:26:25 +00:00

11 lines
210 B
C

// Build don't link:
// Origin: Mark Mitchell <mark@codesourcery.com>
void f() {
int *i = 0;
const int *c = 0;
static_cast <const int *>(i);
static_cast <int *>(c); // ERROR - casts away constness
}