Bug ID: 84306
           Summary: Wrong overload selected with -std=c++17, explicit and
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot
          Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Following code uses function (1), however function (2) must be used.

struct foo {
    foo() = default;

    foo(foo const&);   // (1)

    template<typename T>
    explicit foo(T&&); // (2)

int main() {
    foo f1;
    foo f2{f1};  // (1) - wrong, must be (2)

The compiler chooses the right function if 'explicit' is removed, or if '{f1}'
is replaced with '(f1)', or if -std=c++17 option is changed to -std=c++14.

Reply via email to