This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14430] New: constructors with rectroactively declared default argument not considered for conversions
- From: "heinlein at informatik dot uni-ulm dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Mar 2004 09:51:25 -0000
- Subject: [Bug c++/14430] New: constructors with rectroactively declared default argument not considered for conversions
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
[class.conv.ctor] A constructor ... that can be called with a single parameter
specifies a conversion ...
Thus, lines 2 and 3 below should be correct,
while lines 1 and 4 should not
(the latter because the conversion from int to Y is ambigious).
However, line 2 is rejected,
while line 4 is accepted.
struct X {
X (int, int);
};
X x1 = 1; // 1
X::X (int, int = 0) {}
X x2 = 1; // 2
struct Y {
Y (int);
Y (int, int);
};
Y y1 = 1; // 3
Y::Y (int, int = 0) {}
Y y2 = 1; // 4
--
Summary: constructors with rectroactively declared default
argument not considered for conversions
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: heinlein at informatik dot uni-ulm dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14430