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

            Bug ID: 88026
           Summary: Explicit deduction guide fails for move-only type
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: toe-ger at web dot de
  Target Milestone: ---

*Example code*:
struct move_only {
    move_only() = default;
    move_only(const move_only &) = delete;
};

template <class T>
struct S {
    S(T &){}
};

template <class T>
S(T)->S<T>;

int main() {
    move_only m;
    S s = m;
    (void)s;
}

*Expected output*:
*Actual output*:
<source>: In function 'int main()':
<source>:16:11: error: class template argument deduction failed:
     S s = m;
           ^
<source>:16:11: error: use of deleted function 'move_only::move_only(const
move_only&)'
<source>:3:5: note: declared here
     move_only(const move_only &) = delete;
     ^~~~~~~~~
<source>:12:1: note:   initializing argument 1 of 'S(T)-> S<T> [with T =
move_only]'
 S(T)->S<T>;
 ^

*Reproduction*:
https://godbolt.org/z/G0_8dw

Reply via email to