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

            Bug ID: 70827
           Summary: [6 regression] dubious use of deleted function in
                    inherited constructor
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr
  Target Milestone: ---

struct move_only {
    move_only() = default;
    move_only(move_only&&) = default;
};

struct base {
    base(move_only) {}
};

struct derived: base {
    // error: use of deleted function 'constexpr move_only::move_only(const
move_only&)'
    using base::base;
};

int main()
{
    // note: synthesized method 'derived::derived(move_only)' first required
here
    derived h(move_only {});
}

=====

Using GCC 6.1:

$ g++-trunk --version
g++-trunk (GCC) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++-trunk -std=c++11 main.cpp 
main.cpp: In constructor 'derived::derived(move_only)':
main.cpp:12:17: error: use of deleted function 'constexpr
move_only::move_only(const move_only&)'
     using base::base;
                 ^~~~
main.cpp:1:8: note: 'constexpr move_only::move_only(const move_only&)' is
implicitly declared as deleted because 'move_only' declares a move constructor
or move assignment operator
 struct move_only {
        ^~~~~~~~~
main.cpp: In function 'int main()':
main.cpp:18:27: note: synthesized method 'derived::derived(move_only)' first
required here 
     derived h(move_only {});

=====

The program compiles fine with 5.3.1, earlier 6 snapshots, and Clang.

Reply via email to