[Bug c++/14430] New: constructors with rectroactively declared default argument not considered for conversions

heinlein at informatik dot uni-ulm dot de gcc-bugzilla@gcc.gnu.org
Thu Mar 4 09:51:00 GMT 2004


[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



More information about the Gcc-bugs mailing list