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: [email protected]
ReportedBy: [email protected]
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);
------------------------