public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
@ 2007-02-09 14:02 ` manu at gcc dot gnu dot org
  2007-10-17 11:26 ` manu at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-02-09 14:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2007-02-09 14:02 -------
Is this a duplicate of PR 11159 or are they different?


-- 


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
  2007-02-09 14:02 ` [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized manu at gcc dot gnu dot org
@ 2007-10-17 11:26 ` manu at gcc dot gnu dot org
  2007-10-18  9:43 ` nathan at codesourcery dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-10-17 11:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2007-10-17 11:26 -------
Does this patch makes any sense? This needs testcases (suggestions for extra
testcases are welcome), Changelog, bootstrap + testing and proper submission.


--- init.c      2007-09-20 15:13:00.000000000 +0100
+++ init.c.fixed        2007-10-17 12:20:24.000000000 +0100
@@ -684,10 +684,11 @@ emit_mem_initializers (tree mem_inits)

       /* If these initializations are taking place in a copy
         constructor, the base class should probably be explicitly
-        initialized.  */
+        initialized unless it is nearly empty.  */
       if (extra_warnings && !arguments
          && DECL_COPY_CONSTRUCTOR_P (current_function_decl)
-         && TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (subobject)))
+         && TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (subobject))
+          && !CLASSTYPE_NEARLY_EMPTY_P (BINFO_TYPE (subobject))
        warning (OPT_Wextra, "%Jbase class %q#T should be explicitly
initialized in the "
                 "copy constructor",
                 current_function_decl, BINFO_TYPE (subobject));


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-12-11 21:53:55         |2007-10-17 11:26:12
               date|                            |


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
  2007-02-09 14:02 ` [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized manu at gcc dot gnu dot org
  2007-10-17 11:26 ` manu at gcc dot gnu dot org
@ 2007-10-18  9:43 ` nathan at codesourcery dot com
  2007-10-30  3:46 ` patchapp at dberlin dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: nathan at codesourcery dot com @ 2007-10-18  9:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from nathan at codesourcery dot com  2007-10-18 09:43 -------
Subject: Re:  gcc warns that pure virtual class not explicitly
 initialized

manu at gcc dot gnu dot org wrote:
> ------- Comment #4 from manu at gcc dot gnu dot org  2007-10-17 11:26 -------
> Does this patch makes any sense? This needs testcases (suggestions for extra
> testcases are welcome), Changelog, bootstrap + testing and proper submission.

this patch looks reasonable.

nathan


-- 


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2007-10-18  9:43 ` nathan at codesourcery dot com
@ 2007-10-30  3:46 ` patchapp at dberlin dot org
  2007-11-14 13:38 ` jwakely dot gcc at gmail dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: patchapp at dberlin dot org @ 2007-10-30  3:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from patchapp at dberlin dot org  2007-10-30 03:46 -------
Subject: Bug number PR c++/5645

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-10/msg01639.html


-- 


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2007-10-30  3:46 ` patchapp at dberlin dot org
@ 2007-11-14 13:38 ` jwakely dot gcc at gmail dot com
  2008-02-13 11:13 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2007-11-14 13:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jwakely dot gcc at gmail dot com  2007-11-14 13:38 -------
Isn't this warning simply bogus?  In other contexts if a default constructor is
available it will be used without warning, whether explicitly used or not.

e.g.
non-virtual bases in constructor initializer lists
data members in constructor initializer lists
"new T" vs "new T()"
"T t;" vs "T t = T();"

This warning seems to be an attempt to enforce someone's personal preference,
rather than any concerns about correctness.  As shown by comment 9 on bug
11159, in some cases it's not even possible to do what the warning says you
"should" do.


-- 

jwakely dot gcc at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely dot gcc at gmail dot
                   |                            |com


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2007-11-14 13:38 ` jwakely dot gcc at gmail dot com
@ 2008-02-13 11:13 ` manu at gcc dot gnu dot org
  2008-02-13 11:24 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-13 11:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from manu at gcc dot gnu dot org  2008-02-13 11:13 -------
*** Bug 11159 has been marked as a duplicate of this bug. ***


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris at kolpackov dot net


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2008-02-13 11:13 ` manu at gcc dot gnu dot org
@ 2008-02-13 11:24 ` manu at gcc dot gnu dot org
  2008-02-13 11:38 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-13 11:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from manu at gcc dot gnu dot org  2008-02-13 11:23 -------
Created an attachment (id=15136)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15136&action=view)
patch and testcases

This patch contains an attempt to implement the suggestions given here:
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00149.html

It also contains all testcases from PR 5645 and PR 11159.

The tests in g++.dg/warn/pr5645.C pass.
The tests in g++.dg/warn/pr11159.C fail.

The fundamental problem is that I don't understand what this warning is warning
about. And nobody seems to have a clear idea either. 

Unless someone can put forward a clear definition that is justified for the
testcases above and provides new testcases (either positive or negative), I am
not going to work anymore on this (except if asked to remove the warning
altogether).


-- 


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2008-02-13 11:24 ` manu at gcc dot gnu dot org
@ 2008-02-13 11:38 ` manu at gcc dot gnu dot org
  2008-02-14 23:12 ` jason at gcc dot gnu dot org
  2008-02-14 23:39 ` manu at gcc dot gnu dot org
  9 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-13 11:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from manu at gcc dot gnu dot org  2008-02-13 11:38 -------
Created an attachment (id=15137)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15137&action=view)
patch and testcases

Correct patch, the previous one did not contain pr11159.C


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #15136|0                           |1
        is obsolete|                            |


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2008-02-13 11:38 ` manu at gcc dot gnu dot org
@ 2008-02-14 23:12 ` jason at gcc dot gnu dot org
  2008-02-14 23:39 ` manu at gcc dot gnu dot org
  9 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-02-14 23:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jason at gcc dot gnu dot org  2008-02-14 23:11 -------
Subject: Bug 5645

Author: jason
Date: Thu Feb 14 23:11:04 2008
New Revision: 132324

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132324
Log:
        PR c++/5645
        PR c++/11159
        * class.c (type_has_user_nondefault_constructor): New fn.
        * cp-tree.h: Declare it.
        * init.c (emit_mem_initializers): Use it for -W warning about
        missing base initializer.

Added:
    trunk/gcc/testsuite/g++.dg/warn/pr11159.C
    trunk/gcc/testsuite/g++.dg/warn/pr5645.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/g++.dg/warn/Wreorder-1.C


-- 


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2008-02-14 23:12 ` jason at gcc dot gnu dot org
@ 2008-02-14 23:39 ` manu at gcc dot gnu dot org
  9 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-14 23:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from manu at gcc dot gnu dot org  2008-02-14 23:39 -------
Fixed in GCC 4.3 per Jason's commit. Not worth fixing it in branches.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <20020209123600.5645.tom@wact.net>
  2003-08-27 14:48 ` bangerth at dealii dot org
  2003-08-28 14:49 ` pinskia at gcc dot gnu dot org
@ 2005-06-20  4:06 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-20  4:06 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
   Last reconfirmed|2004-04-26 19:41:58         |2005-06-20 04:06:31
               date|                            |


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


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <20020209123600.5645.tom@wact.net>
  2003-08-27 14:48 ` bangerth at dealii dot org
@ 2003-08-28 14:49 ` pinskia at gcc dot gnu dot org
  2005-06-20  4:06 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-28 14:49 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


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

* [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized
       [not found] <20020209123600.5645.tom@wact.net>
@ 2003-08-27 14:48 ` bangerth at dealii dot org
  2003-08-28 14:49 ` pinskia at gcc dot gnu dot org
  2005-06-20  4:06 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2003-08-27 14:48 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


------- Additional Comments From bangerth at dealii dot org  2003-08-27 14:48 -------
This isn't fixed, in neither 3.2, 3.3 not mainline, or it has re-appeared. I can still see the 
same warning with all these versions. 
 
W.


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

end of thread, other threads:[~2008-02-14 23:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-5645-2936@http.gcc.gnu.org/bugzilla/>
2007-02-09 14:02 ` [Bug c++/5645] gcc warns that pure virtual class not explicitly initialized manu at gcc dot gnu dot org
2007-10-17 11:26 ` manu at gcc dot gnu dot org
2007-10-18  9:43 ` nathan at codesourcery dot com
2007-10-30  3:46 ` patchapp at dberlin dot org
2007-11-14 13:38 ` jwakely dot gcc at gmail dot com
2008-02-13 11:13 ` manu at gcc dot gnu dot org
2008-02-13 11:24 ` manu at gcc dot gnu dot org
2008-02-13 11:38 ` manu at gcc dot gnu dot org
2008-02-14 23:12 ` jason at gcc dot gnu dot org
2008-02-14 23:39 ` manu at gcc dot gnu dot org
     [not found] <20020209123600.5645.tom@wact.net>
2003-08-27 14:48 ` bangerth at dealii dot org
2003-08-28 14:49 ` pinskia at gcc dot gnu dot org
2005-06-20  4:06 ` pinskia at gcc dot gnu 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).