[Bug c++/54521] New: g++ fails to call explicit constructors in the second step of copy initialization
tsoae at mail dot ru
gcc-bugzilla@gcc.gnu.org
Fri Sep 7 20:38:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54521
Bug #: 54521
Summary: g++ fails to call explicit constructors in the second
step of copy initialization
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: tsoae@mail.ru
g++ fails to compile the following code
struct X
{
X(int) {}
explicit X(X const &) {}
};
int main()
{
X x = 1; // error: no matching function for call to 'X::X(X)'
}
The second step of a copy initialization (see 8.5/16/6/2) is a
direct-initialization where explicit constructors shall be considered as
candidate functions.
More information about the Gcc-bugs
mailing list