public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67519] New: New warning: calls to member functions before all base classes constructed
@ 2015-09-09 13:04 redi at gcc dot gnu.org
  2015-09-09 13:25 ` [Bug c++/67519] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-09 13:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67519

            Bug ID: 67519
           Summary: New warning: calls to member functions before all base
                    classes constructed
           Product: gcc
           Version: 4.9.4
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

It's undefined to (directly or indirectly) call a member function in a
ctor-initializer before all the mem-initializers for base classes have
completed ([class.base.init] p16).

It should be possible to warn about this, at least for simple cases.

The example in [class.base.init] p16 should give two warnings:

class A {
public:
  A(int);
};

class B : public A {
  int j;
public:
  int f();
  B() : A(f()), // undefined: calls member function
                // but base A not yet initialized
  j(f()) { }    // well-defined: bases are all initialized
};

class C {
public:
  C(int);
};

class D : public B, C {
  int i;
public:
  D() : C(f()), // undefined: calls member function
                // but base C not yet initialized
  i(f()) { }    // well-defined: bases are all initialized
};


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

* [Bug c++/67519] New warning: calls to member functions before all base classes constructed
  2015-09-09 13:04 [Bug c++/67519] New: New warning: calls to member functions before all base classes constructed redi at gcc dot gnu.org
@ 2015-09-09 13:25 ` pinskia at gcc dot gnu.org
  2015-09-12 14:44 ` trippels at gcc dot gnu.org
  2015-09-12 16:16 ` [Bug c++/67519] warn for " manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-09-09 13:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67519

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-09
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There might be a duplicate of this bug already.

Confirmed.


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

* [Bug c++/67519] New warning: calls to member functions before all base classes constructed
  2015-09-09 13:04 [Bug c++/67519] New: New warning: calls to member functions before all base classes constructed redi at gcc dot gnu.org
  2015-09-09 13:25 ` [Bug c++/67519] " pinskia at gcc dot gnu.org
@ 2015-09-12 14:44 ` trippels at gcc dot gnu.org
  2015-09-12 16:16 ` [Bug c++/67519] warn for " manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-09-12 14:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67519

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trippels at gcc dot gnu.org

--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Also -fsanitize=undefined doesn't handle this issue yet.


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

* [Bug c++/67519] warn for calls to member functions before all base classes constructed
  2015-09-09 13:04 [Bug c++/67519] New: New warning: calls to member functions before all base classes constructed redi at gcc dot gnu.org
  2015-09-09 13:25 ` [Bug c++/67519] " pinskia at gcc dot gnu.org
  2015-09-12 14:44 ` trippels at gcc dot gnu.org
@ 2015-09-12 16:16 ` manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2015-09-12 16:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67519

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org
            Summary|New warning: calls to       |warn for calls to member
                   |member functions before all |functions before all base
                   |base classes constructed    |classes constructed

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Perhaps related to PR19808 (one has to keep track of what has been initialized
while parsing the member initializer list).
>From gcc-bugs-return-497050-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 12 16:35:57 2015
Return-Path: <gcc-bugs-return-497050-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 89204 invoked by alias); 12 Sep 2015 16:35:56 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 89162 invoked by uid 55); 12 Sep 2015 16:35:53 -0000
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/66965] gnat.dg/specs/addr1.ads obsolete -- failing on trunk
Date: Sat, 12 Sep 2015 16:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ada
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ebotcazou at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66965-4-ZJfogy84TD@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66965-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66965-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01028.txt.bz2
Content-length: 426

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf965

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Author: ebotcazou
Date: Sat Sep 12 16:35:20 2015
New Revision: 227709

URL: https://gcc.gnu.org/viewcvs?rev"7709&root=gcc&view=rev
Log:
        PR ada/66965
        * gnat.dg/specs/addr1.ads: Remove.

Removed:
    trunk/gcc/testsuite/gnat.dg/specs/addr1.ads
Modified:
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2015-09-12 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-09 13:04 [Bug c++/67519] New: New warning: calls to member functions before all base classes constructed redi at gcc dot gnu.org
2015-09-09 13:25 ` [Bug c++/67519] " pinskia at gcc dot gnu.org
2015-09-12 14:44 ` trippels at gcc dot gnu.org
2015-09-12 16:16 ` [Bug c++/67519] warn for " manu at gcc dot gnu.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).