public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: tom@wact.net
To: gcc-gnats@gcc.gnu.org
Cc: tuffner@autotote.com
Subject: c++/5645: gcc warns that pure virtual class not explicitly initialized
Date: Sat, 09 Feb 2002 12:36:00 -0000	[thread overview]
Message-ID: <20020209203110.2219.qmail@sources.redhat.com> (raw)


>Number:         5645
>Category:       c++
>Synopsis:       gcc warns that pure virtual class not explicitly initialized
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 09 12:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Tom Uffner
>Release:        gcc version 3.0.3
>Organization:
>Environment:
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.3/specs
Configured with: ../configure --with-as=/usr/local/bin/as --with-ld=/usr/local/bin/ld --enable-libgcj
Thread model: posix
gcc version 3.0.3
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.3/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=3 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem=unix -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HOSTED__=1 -W -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc moo.cpp -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase moo.cpp -W -version -o /var/tmp/cc9O5r3j.s
GNU CPP version 3.0.3 (cpplib) (sparc)
GNU C++ version 3.0.3 (sparc-sun-solaris2.8)
        compiled by GNU C version 3.0.3.
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++-v3
 /usr/local/include/g++-v3/sparc-sun-solaris2.8
 /usr/local/include/g++-v3/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.3/include
 /usr/local/sparc-sun-solaris2.8/include
 /usr/include
End of search list.
>Description:
g++ issues a warning that a pure virtual base class with
no data members should be initialized when when it compiles
copy constructors of a derived class. 

this error also occurs in previous compiler versions and
platforms other than the one this PR was submitted from
>How-To-Repeat:
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) {
    i = c.i;
}

% c++ -v -W -Wall -c moo.cpp
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.3/specs
Configured with: ../configure --with-as=/usr/local/bin/as --with-ld=/usr/local/bin/ld --enable-libgcj
Thread model: posix
gcc version 3.0.3
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.3/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=3 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem=unix -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HOSTED__=1 -W -Wall -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc moo.cpp -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase moo.cpp -W -Wall -version -o /var/tmp/ccOlmk8T.s
GNU CPP version 3.0.3 (cpplib) (sparc)
GNU C++ version 3.0.3 (sparc-sun-solaris2.8)
        compiled by GNU C version 3.0.3.
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++-v3
 /usr/local/include/g++-v3/sparc-sun-solaris2.8
 /usr/local/include/g++-v3/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.3/include
 /usr/local/sparc-sun-solaris2.8/include
 /usr/include
End of search list.
moo.cpp: In copy constructor `b::b(const b&)':
moo.cpp:19: warning: base class `class a' should be explicitly initialized in 
   the copy constructor
 /usr/local/bin/as -V -Qy -s -o moo.o /var/tmp/ccOlmk8T.s
GNU assembler version 2.11.2 (sparc-sun-solaris2.8) using BFD version 2.11.2
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-02-09 20:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-09 12:36 tom [this message]
2002-09-14 15:44 nathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020209203110.2219.qmail@sources.redhat.com \
    --to=tom@wact.net \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=tuffner@autotote.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).