This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/8057] [3.3/3.4 regression] Templates/non-templates and warnings about statements without effects
- From: "gdr at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jul 2003 16:04:26 -0000
- Subject: [Bug c++/8057] [3.3/3.4 regression] Templates/non-templates and warnings about statements without effects
- References: <20020926115600.8057.bangerth@ticam.utexas.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8057
gdr at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at codesourcery dot com
AssignedTo|gdr at gcc dot gnu dot org |unassigned at gcc dot gnu
| |dot org
Status|NEW |ASSIGNED
------- Additional Comments From gdr at gcc dot gnu dot org 2003-07-07 16:04 -------
This PR has nothing to do with diagnostics per se. The diagnostic thing is just
a symptom of a much fuhndamental desease: It has to do with function cloning and
inlining. More specifically, the double emission of diagnostic is due to the
fact that the constructor is cloned, hence its body is expanded twice.
The absence of diagnostic in Z::Z() is due to the fact that it is an inline
function and starting from some GCC-3.x, an inline function is defined (hence
its body expanded) only if used. To see what I mean, make the definition of
Z::Z() a non-inline function and you'll see the warning.
If you add the following
struct A {
void f();
};
void
A::f() { Y::i; }
you'll see that the diagnostic is emitted only once.
So, this issue has nothing to do with templates per se. It all has to do with
cloning and inlining. So I'll hand it off.