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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [explicit2.C] - Rev 693

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) { }
};

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.