This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33515] Inconsistent warning about "defined but not used" when there is an error
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Sep 2007 03:57:01 -0000
- Subject: [Bug c++/33515] Inconsistent warning about "defined but not used" when there is an error
- References: <bug-33515-11211@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from bangerth at dealii dot org 2007-09-22 03:57 -------
This code:
----------------
class Alpha { public: Alpha(); };
static Alpha* a1 = new Alpha;
----------------
should definitely not draw a warning because during the initialization
of the variable, the constructor of Alpha is run which could have side
effects. Doing stuff like this is actually a fairly frequently used
idiom whereby we can assure that certain resources are already allocated
before we even get to main().
W.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33515