Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.jason/warning2.C

raw
1 // { dg-do assemble }
2 // g++ ought to warn about casting a base pointer to a derived reference.
3
4 struct A {
5 virtual void f () = 0;
6 };
7
8 struct B: public A { void f () { } };
9
10 int main()
11 {
12 B* bp;
13 A& ar = (A&)bp; // { dg-warning "11:casting .B\\*. to .A&. does not dereference pointer" }
14 }