public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class
@ 2013-02-14 14:35 t-gcc-bugzilla at snowelm dot com
2013-02-14 14:42 ` [Bug c++/56323] " redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: t-gcc-bugzilla at snowelm dot com @ 2013-02-14 14:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56323
Bug #: 56323
Summary: [C++11] cannot compile inherited constructor for
typedef'ed base class
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: t-gcc-bugzilla@snowelm.com
Consider the following code that uses inherited constructor from a typedef'ed
type:
------------------------
struct A {
A(int i);
};
typedef A B;
struct C : B {
using B::B; // compile error by gcc
};
struct D : B {
using B::A; // this is compiled as inherited constructor
};
C c(0);
D d(0);
------------------------
I believe that C should be valid, while D should be reported as invalid.
However I cannot find anything about this problem in the C++11 standard...
In template programming, using inherited constructor is sometimes virtually
impossible, as in the following example.
------------------------
struct A {
A(int i);
};
template <class T>
struct E {
typedef T type;
};
template <class T>
struct F : E<T>::type {
using E<T>::type::type; // error: E<T>::type is a typedef
};
F<A> f(0);
------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56323] [C++11] cannot compile inherited constructor for typedef'ed base class
2013-02-14 14:35 [Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class t-gcc-bugzilla at snowelm dot com
@ 2013-02-14 14:42 ` redi at gcc dot gnu.org
2013-02-14 16:42 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-14 14:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56323
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-02-14
CC| |jason at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-14 14:42:20 UTC ---
I think [class.qual]/2 says both C and D are valid.
C is valid because it is a using-declaration that is a member-declaration and
the name specified after the nested-name-specifier is the same as the
identifier in the last component of the nested-name-specifier.
D is valid because the name specified after the nested-name-specifier is the
injected-class-name of A.
In both cases the using-declaration names the constructor, so it declares a set
of inheriting constructors.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56323] [C++11] cannot compile inherited constructor for typedef'ed base class
2013-02-14 14:35 [Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class t-gcc-bugzilla at snowelm dot com
2013-02-14 14:42 ` [Bug c++/56323] " redi at gcc dot gnu.org
@ 2013-02-14 16:42 ` jason at gcc dot gnu.org
2013-02-15 1:27 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-14 16:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56323
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56323] [C++11] cannot compile inherited constructor for typedef'ed base class
2013-02-14 14:35 [Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class t-gcc-bugzilla at snowelm dot com
2013-02-14 14:42 ` [Bug c++/56323] " redi at gcc dot gnu.org
2013-02-14 16:42 ` jason at gcc dot gnu.org
@ 2013-02-15 1:27 ` jason at gcc dot gnu.org
2013-02-15 9:10 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-15 1:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56323
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-15 01:27:09 UTC ---
Author: jason
Date: Fri Feb 15 01:27:03 2013
New Revision: 196067
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196067
Log:
PR c++/56323
* name-lookup.c (do_class_using_decl): Handle typedefs with
inheriting constructors.
(push_class_level_binding_1): Allow inheriting from template
template parameter, too.
* pt.c (tsubst_decl) [USING_DECL]: Likewise.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/inh-ctor17.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/name-lookup.c
trunk/gcc/cp/pt.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56323] [C++11] cannot compile inherited constructor for typedef'ed base class
2013-02-14 14:35 [Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class t-gcc-bugzilla at snowelm dot com
` (2 preceding siblings ...)
2013-02-15 1:27 ` jason at gcc dot gnu.org
@ 2013-02-15 9:10 ` redi at gcc dot gnu.org
2013-02-15 11:17 ` paolo.carlini at oracle dot com
2013-02-27 18:14 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-15 9:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56323
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |potswa at mac dot com
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-15 09:10:28 UTC ---
*** Bug 56333 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56323] [C++11] cannot compile inherited constructor for typedef'ed base class
2013-02-14 14:35 [Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class t-gcc-bugzilla at snowelm dot com
` (3 preceding siblings ...)
2013-02-15 9:10 ` redi at gcc dot gnu.org
@ 2013-02-15 11:17 ` paolo.carlini at oracle dot com
2013-02-27 18:14 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-15 11:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56323
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.8.0
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-15 11:17:07 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/56323] [C++11] cannot compile inherited constructor for typedef'ed base class
2013-02-14 14:35 [Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class t-gcc-bugzilla at snowelm dot com
` (4 preceding siblings ...)
2013-02-15 11:17 ` paolo.carlini at oracle dot com
@ 2013-02-27 18:14 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-27 18:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56323
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-27 18:13:34 UTC ---
Author: jason
Date: Wed Feb 27 18:13:24 2013
New Revision: 196316
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196316
Log:
PR c++/56358
PR c++/56323
* name-lookup.c (do_class_using_decl): Use ctor_identifier instead
of the base name for inheriting ctors.
(push_class_level_binding_1): Remove inheriting ctor handling.
* pt.c (tsubst_decl) [USING_DECL]: Likewise.
* class.c (add_implicitly_declared_members): Adjust.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/inh-ctor18.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/class.c
trunk/gcc/cp/name-lookup.c
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/g++.dg/inherit/using5.C
trunk/gcc/testsuite/g++.old-deja/g++.other/using3.C
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-02-27 18:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-14 14:35 [Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class t-gcc-bugzilla at snowelm dot com
2013-02-14 14:42 ` [Bug c++/56323] " redi at gcc dot gnu.org
2013-02-14 16:42 ` jason at gcc dot gnu.org
2013-02-15 1:27 ` jason at gcc dot gnu.org
2013-02-15 9:10 ` redi at gcc dot gnu.org
2013-02-15 11:17 ` paolo.carlini at oracle dot com
2013-02-27 18:14 ` jason 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).