+2001-11-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/3471
+ * call.c (convert_like_real): Do not build additional temporaries
+ for rvalues of class type.
+
2001-11-28 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (UNIQUELY_DERIVED_FROM_P): Use lookup base.
If the target is a class, that means call a ctor. */
if (IS_AGGR_TYPE (totype)
- && (inner >= 0 || !real_lvalue_p (expr)))
+ && (inner >= 0 || !lvalue_p (expr)))
{
savew = warningcount, savee = errorcount;
expr = build_new_method_call
class A
{
public:
- A(int j) { i = j; } // ERROR - candidate
- A(A& a) { i = a.i; } // ERROR - candidate
+ A(int j) { i = j; }
+ A(A& a) { i = a.i; }
operator int() { return i; }
void assign(int v) { i = v; }
// Replacing above with "switch (int(in))" removes the error.
{
case 0:
- out = 1; // ERROR - no usable copy ctor
+ out = 1;
break;
default:
- out = 0; // ERROR - no usable copy ctor
+ out = 0;
break;
}
}
class A {
A();
- A(const A&); // ERROR - referenced below
+ A(const A&);
public:
A(int) { ++count; }
~A() { --count; }
int main() {
{
A a (1);
- if (a == 2 && a == 1) // ERROR - private copy ctor
+ if (a == 2 && a == 1)
;
}
return count;
--- /dev/null
+// Build don't run:
+// Origin: ericp@mit.edu
+
+class bar {
+};
+
+class foo {
+ foo (const foo &f);
+
+public:
+
+ foo (bar x) {}
+ foo () {}
+
+ void test (const foo &f) {}
+};
+
+int main (void) {
+ foo f;
+ bar b;
+
+ f.test (b);
+}