c++/2065: Annoying invalid message on compiler-generated copy constructor -- regression vs. 2.95

wolfgang.bangerth@iwr.uni-heidelberg.de wolfgang.bangerth@iwr.uni-heidelberg.de
Thu Feb 22 23:46:00 GMT 2001


>Number:         2065
>Category:       c++
>Synopsis:       Annoying invalid message on compiler-generated copy constructor -- regression vs. 2.95
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 22 23:46:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
gcc version 3.0 20010221 (prerelease), Sun Solaris 2.7
>Description:
This is rather annoying, since it generates warnings from
libstdc++ files for me all over the place in string and
exception classes, and one can not work around without
switching off warnings. It took me some hours to extract
this little 2-liner from standard include files:

deal.II/base> cat t.cc
struct exception {  virtual void what(); };
void f()         {  throw exception();   };


deal.II/base> gcc -Wall -W -c t.cc -o /dev/null
t.cc: In method `exception::exception(const exception&)':
t.cc:1: warning: unused parameter `const exception&_ctor_arg'

deal.II/base> gcc -v
Reading specs from /home/people/wolf/Config/gcc-ss-sun/lib/gcc-lib/sparc-sun-solaris2.7/3.0/specs
Configured with: ../gcc/configure --prefix=/home/people/wolf/Config/gcc-ss-sun --with-gnu-as --with-gnu-ld --with-ld=/usr/local/bin/ld --with-as=/usr/local/bin/as
gcc version 3.0 20010221 (prerelease)


Originally, exception was std::exception, and f() was a
function throwing std::bad_alloc in some context. Note
that funny enough, if I omit *either* -W or -Wall, then
the warning goes away. There seems to be some interference
between the two that I feel is wrong, as the warning should
be triggered by one or both of the two, but certainly not
only if they are given in conjunction.

This as a small contribution to the quality of GCC 3.0,
best regards
  Wolfgang

PS: I have filed c++/1628 some time ago that might be related,
but this one is worse since it occurs in code that the
compiler generates automatically, so I can't change what
happens here (besides, this all happens inside the std lib).
This and c++/1628 are regressions w.r.t. gcc2.95
>How-To-Repeat:
gcc -Wall -W -c t.cc
>Fix:

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



More information about the Gcc-bugs mailing list