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

            Bug ID: 66350
           Summary: typename should be forbidden in inhering constructors
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vgheorgh at gmail dot com
  Target Milestone: ---

The code below

#include <memory>

template <class T, class Deleter = std::default_delete<T>>
class unique_ptr_wrapper: public std::unique_ptr<T, Deleter>
{
public:
    using typename std::unique_ptr<T, Deleter>::unique_ptr; // typename should
be forbidden here
};

int main()
{
    unique_ptr_wrapper<int> upw{new int{42}};
}

should be ill formed (no typename required), since we inherit a constructor,
which is not a dependent type. IMO, a diagnostic should be required, however
g++ compiles the program without any warnings. 

Tested with gcc4.9/5.1/6 HEAD.

More details: http://stackoverflow.com/q/30554119/3093378

Reply via email to