URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [explicit2.C] - Rev 378
Go to most recent revision | Compare with Previous | Blame | View Log
// Test for explicit conversion ops in various conversion situations.
// { dg-options "-std=c++0x" }
typedef void (*pfn)();
struct A
{
explicit operator int() const;
explicit operator pfn() const;
};
int main()
{
A a;
int i = a; // { dg-error "" }
const int &ir = a; // { dg-error "" }
a(); // { dg-error "" }
a + 1; // { dg-message "" } (error and note on same line)
int j (a);
(int)a;
static_cast<int>(a);
}
struct B
{
int i;
B(const A& a): i(a) { }
};
Go to most recent revision | Compare with Previous | Blame | View Log