[Bug c++/56323] New: [C++11] cannot compile inherited constructor for typedef'ed base class

t-gcc-bugzilla at snowelm dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 14 14:35:00 GMT 2013


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);
------------------------



More information about the Gcc-bugs mailing list