diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.jason/warning2.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.jason/warning2.C | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/warning2.C b/gcc/testsuite/g++.old-deja/g++.jason/warning2.C new file mode 100644 index 000000000..6298587e8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/warning2.C @@ -0,0 +1,14 @@ +// { dg-do assemble } +// g++ ought to warn about casting a base pointer to a derived reference. + +struct A { + virtual void f () = 0; +}; + +struct B: public A { void f () { } }; + +int main() +{ + B* bp; + A& ar = (A&)bp; // { dg-warning "" } +} |