[Bug c++/84306] New: Wrong overload selected with -std=c++17, explicit and {}
antoshkka at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Feb 9 11:03:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84306
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 gnu.org
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.
More information about the Gcc-bugs
mailing list