[Bug c++/88026] Explicit deduction guide fails for move-only type

2018-11-14 Thread toe-ger at web dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88026

--- Comment #2 from toe-ger at web dot de ---
Workaround that seems to generally work:
Change deduction guide to

template 
S(T&&)->S>;

[Bug c++/88026] Explicit deduction guide fails for move-only type

2018-11-14 Thread toe-ger at web dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88026

--- Comment #1 from toe-ger at web dot de ---
Godbolt decided to swap the output from gcc and msvc again. Sorry for that.

[Bug c++/88026] New: Explicit deduction guide fails for move-only type

2018-11-14 Thread toe-ger at web dot de
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 
struct S {
S(T &){}
};

template 
S(T)->S;

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

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

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

[Bug c++/88020] Deduction guides fail inside sizeof

2018-11-14 Thread toe-ger at web dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88020

--- Comment #1 from toe-ger at web dot de ---
The godbolt link is a bit confusing because the output window is in the wrong
place. https://godbolt.org/z/OvlkUA is better.

[Bug c++/88020] New: Template argument deduction fails inside sizeof

2018-11-14 Thread toe-ger at web dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88020

Bug ID: 88020
   Summary: Template argument deduction fails inside sizeof
   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: ---

*Minimal example*:
template 
struct S{
S(T){}
};
static_assert(sizeof(S{0}));

*Expected output*:
*Actual output*:
:5:22: error: missing template arguments after 'S'
 static_assert(sizeof(S{0}));
  ^
:2:8: note: 'template struct S' declared here
 struct S{
^
*Reproduction*:
https://godbolt.org/z/9XLvfT
(currently also fails on trunk)
Note: Deduction guides are a C++17 feature and requires -std=c++17.
S s{0}; compiles.