blob: 3348dcee8a35dfbe239f959e0187e13e2018db02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 3 Jan 2000 <nathan@acm.org>
// Derived from a bug report by Ulrich Drepper <drepper@cygnus.com>
struct A {operator char * () { return 0;} };
struct B {operator char * () const { return 0;} };
struct C {operator char const * () { return 0;} };
struct D {operator char const * () const { return 0;} };
void f0 ()
{
A a = A ();
B b = B ();
C c = C ();
D d = D ();
static_cast <char *> (a);
static_cast <char *> (b);
static_cast <char *> (c); // { dg-error "" } static cast
static_cast <char *> (d); // { dg-error "" } static cast
}
void f1 ()
{
A a = A ();
B b = B ();
C c = C ();
D d = D ();
static_cast <const char *> (a);
static_cast <const char *> (b);
static_cast <const char *> (c);
static_cast <const char *> (d);
}
void f2 ()
{
A const a = A ();
B const b = B ();
C const c = C ();
D const d = D ();
static_cast <char *> (a); // { dg-error "" } static cast
static_cast <char *> (b);
static_cast <char *> (c); // { dg-error "" } static cast
static_cast <char *> (d); // { dg-error "" } static cast
}
void f3 ()
{
A const a = A ();
B const b = B ();
C const c = C ();
D const d = D ();
static_cast <const char *> (a); // { dg-error "" } static cast
static_cast <const char *> (b);
static_cast <const char *> (c); // { dg-error "" } static cast
static_cast <const char *> (d);
}
|