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
* [Bug c++/65906] using-declaration allowed for non-direct base class
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 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: danregister at poczta dot fm @ 2015-04-27 14:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65906
--- Comment #1 from Daniel Adamski <danregister at poczta dot fm> ---
Just to clarify, it is "Base()" that's being called, not "Base(int, int)" (I
should have used something else than "__func__").
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/65906] using-declaration allowed for non-direct base class
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
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-27 17:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65906
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-04-27
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Daniel Adamski from comment #0)
> Possible duplicate: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
Maybe, but there is a specific rule regarding inheriting constructors that
applies here and not for 32039, in [namespace.udecl]/3:
If such a using-declaration names a constructor, the nested-name-specifier
shall name a direct base class of the class being defined;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/65906] using-declaration allowed for non-direct base class
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
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27 21:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65906
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |7.0
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was fixed with r7-4255: Implement P0136R1, Rewording inheriting
constructors.
Which makes sense.
^ 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).