public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17006] New: unused variable warning only shown on existing constructor
@ 2004-08-12 16:52 oliverst at online dot de
  2004-08-12 17:35 ` [Bug c++/17006] " bangerth at dealii dot org
  0 siblings, 1 reply; 2+ messages in thread
From: oliverst at online dot de @ 2004-08-12 16:52 UTC (permalink / raw)
  To: gcc-bugs

The following code gives this warning:

62 C:\Dev-Cpp\Projects\gcc-test\main.cpp
[Warning] unused variable 'x'

If you uncomment the constructor, the warning does not appear.

class Test
{
    public:        
    //Test() {}
};

int main(int argc, char *argv[])
{
	Test x;
	
  	return 0;
}

Happened on Windows 2000 SP4 with gcc-3.4.1-20040711-1, mingw-
runtime-3.3 and win32api-2.5.
Compiled with "-Wunused".

-- 
           Summary: unused variable warning only shown on existing
                    constructor
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oliverst at online dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17006


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/17006] unused variable warning only shown on existing constructor
  2004-08-12 16:52 [Bug c++/17006] New: unused variable warning only shown on existing constructor oliverst at online dot de
@ 2004-08-12 17:35 ` bangerth at dealii dot org
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth at dealii dot org @ 2004-08-12 17:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-08-12 17:35 -------
That's documented behavior: the warning about unused variables is 
only shown if the compiler can know that running con- and destructors 
has no side-effects. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17006


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-12 17:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-12 16:52 [Bug c++/17006] New: unused variable warning only shown on existing constructor oliverst at online dot de
2004-08-12 17:35 ` [Bug c++/17006] " bangerth at dealii dot org

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).