OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.robertl/] [eb22.C] - Rev 823

Go to most recent revision | Compare with Previous | Blame | View Log

// { dg-do assemble  }
// Ambiguous conversion, three candidates:
// builtin == (int, int), and the two user-defined operators
// Each one requires a user-defined ICS where another uses builtin conversions,
// so none is the best viable function.

class MyInt
{
public:
        MyInt(int = 0) {}
        operator int() const {return 2;}
};

bool operator==(const MyInt& a, const int& b)   // { dg-error "" } candidate
{
        return (int)a == b;
}

bool operator==(const MyInt& a, const MyInt& b) // { dg-error "" } candidate
{
        return (int)a == (int)b;
}

bool f()
{
  return 3 == MyInt();                          // { dg-error "" } ambiguous
}

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.