public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65906] New: using-declaration allowed for non-direct base class
@ 2015-04-27 14:32 danregister at poczta dot fm
  2015-04-27 14:37 ` [Bug c++/65906] " danregister at poczta dot fm
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: danregister at poczta dot fm @ 2015-04-27 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65906
           Summary: using-declaration allowed for non-direct base class
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danregister at poczta dot fm
  Target Milestone: ---

GCC compiles without complaining the following code, which contains
using-declaration which brings constructor of non-direct base class:

----------------------------------------------------------------
#include <iostream>
void log(std::string msg) { std::cout << msg << std::endl; }

struct Base
{
        Base() { log(__func__); }
        Base(int, int) { log(__func__); }
};
struct D1 : Base
{
        D1() { log(__func__); }
};
struct D2 : D1
{
        D2() { log(__func__); }
        using Base::Base;
};

int main()
{
        D2 d(1, 2);
}
----------------------------------------------------------------

The output:

----------------------------------------------------------------
Base
D1
----------------------------------------------------------------

The same code compiled with clang produces: error: 'Base' is not a direct base
of 'D2', cannot inherit constructors

Possible duplicate: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039


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

end of thread, other threads:[~2021-07-27 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-27 14:32 [Bug c++/65906] New: using-declaration allowed for non-direct base class danregister at poczta dot fm
2015-04-27 14:37 ` [Bug c++/65906] " danregister at poczta dot fm
2015-04-27 17:32 ` redi at gcc dot gnu.org
2021-07-27 21:30 ` pinskia 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).