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] - Blame information for rev 774

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

Line No. Rev Author Line
1 693 jeremybenn
// Test for explicit conversion ops in various conversion situations.
2
// { dg-options "-std=c++0x" }
3
 
4
typedef void (*pfn)();
5
 
6
struct A
7
{
8
  explicit operator int() const;
9
  explicit operator pfn() const;
10
};
11
 
12
int main()
13
{
14
  A a;
15
  int i = a;                    // { dg-error "" }
16
  const int &ir = a;           // { dg-error "" }
17
  a();                          // { dg-error "" }
18
  a + 1;                        // { dg-message "" } (error and note on same line)
19
 
20
  int j (a);
21
  (int)a;
22
  static_cast(a);
23
}
24
 
25
struct B
26
{
27
  int i;
28
  B(const A& a): i(a) { }
29
};

powered by: WebSVN 2.1.0

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