diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/pr5645.C')
-rw-r--r-- | gcc/testsuite/g++.dg/warn/pr5645.C | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/pr5645.C b/gcc/testsuite/g++.dg/warn/pr5645.C new file mode 100644 index 000000000..5ca61bdba --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr5645.C @@ -0,0 +1,32 @@ +// PR5645: gcc warns that pure virtual class not explicitly initialized. +// { dg-do compile } +// { dg-options "-Wall -Wextra" } + +class a { +public: + virtual int f() = 0; + virtual int g() = 0; +}; + +class b : public a { +public: + b(); + b(const b& c); + +protected: + int i; +}; + +b::b() {} + +b::b(const b& c) { // { dg-bogus "base class .class a. should be explicitly initialized in the copy constructor" } + i = c.i; +} + +struct X {}; + +struct Y : X +{ + Y (Y const&) {} +}; + |