This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/84306] New: Wrong overload selected with -std=c++17, explicit and {}
- From: "antoshkka at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Feb 2018 11:00:14 +0000
- Subject: [Bug c++/84306] New: Wrong overload selected with -std=c++17, explicit and {}
- Auto-submitted: auto-generated
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.