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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-05-03
                 CC|                            |manu at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-03 
13:09:44 UTC ---
(In reply to comment #0)
> 
> Although the warning is enabled by -Winit-self it is reported as
> -Wuninitialized (which kinda makes sense as it requires both to be active)
> 
> More importantly, I think this code should always warn. 

No, it doesn't make sense. Warnings should be controlled by the same option
used to warn. This is a bug. Please, could you test this patch?

Index: gcc/cp/init.c
===================================================================
--- gcc/cp/init.c       (revision 187018)
+++ gcc/cp/init.c       (working copy)
@@ -573,8 +573,7 @@
   if (decl == error_mark_node)
     return;

-  if (warn_init_self && init && TREE_CODE (init) == TREE_LIST
-      && TREE_CHAIN (init) == NULL_TREE)
+  if (init && TREE_CODE (init) == TREE_LIST && TREE_CHAIN (init) == NULL_TREE)
     {
       tree val = TREE_VALUE (init);
       if (TREE_CODE (val) == COMPONENT_REF && TREE_OPERAND (val, 1) == member


Some testcases may need adjusting. Once tested, feel free to submit it for
approval (but I would consider it as obvious and commit it).

Reply via email to