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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [conversion/] [ptrmem2.C] - Blame information for rev 701

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

Line No. Rev Author Line
1 693 jeremybenn
// Copyright (C) 2007 Free Software Foundation
2
// Contributed by Ollie Wild 
3
// { dg-do compile }
4
 
5
// Assorted pointer to data member static cast tests.
6
 
7
struct A { int x; };
8
struct B : A { int x; };
9
struct P : A { int x; };
10
struct V { int x; };
11
struct D : B, virtual V, private P { int x; };
12
 
13
// Valid static casts.
14
int B::*p1 = static_cast(&D::x);
15
int D::*p2 = static_cast(&B::x);
16
 
17
// Virtual base class.
18
int V::*p3 = static_cast(&D::x);  // { dg-error "" }
19
int D::*p4 = static_cast(&V::x);  // { dg-error "" }
20
 
21
// Inaccessible base class.
22
int P::*p5 = static_cast(&D::x);  // { dg-error "" }
23
int D::*p6 = static_cast(&P::x);  // { dg-error "" }
24
 
25
// Ambiguous base class.
26
int A::*p7 = static_cast(&D::x);  // { dg-error "" }
27
int D::*p8 = static_cast(&A::x);  // { dg-error "" }
28
 
29
// Valid conversions which increase cv-qualification.
30
const int B::*p9 = static_cast(&D::x);
31
const int D::*p10 = static_cast(&B::x);
32
 
33
// Invalid conversions which decrease cv-qualification.
34
int B::*p11 = static_cast(p10); // { dg-error "casts away qualifiers" }
35
int D::*p12 = static_cast(p9);  // { dg-error "casts away qualifiers" }
36
 
37
// Attempts to change member type.
38
float B::*p13 = static_cast(&D::x); // { dg-error "" }
39
float D::*p14 = static_cast(&B::x); // { dg-error "" }

powered by: WebSVN 2.1.0

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