blob: 5743cba1c9212c818028859544782ad23680e309 (
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
|
// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// From: solomon@cs.wisc.edu (Marvin Solomon)
// Message-Id: <9209141509.AA23124@gjetost.cs.wisc.edu>
// Subject: g++ 2.2.2 seems to be forgetting a "const"
// Date: Mon, 14 Sep 92 10:09:58 -0500
extern "C" int printf (const char *, ...);
struct A {
int i;
};
struct B {
int i;
operator const A&() const;
};
B::operator const A&() const {
static A a;
a.i = i;
printf("convert B to A at %x\n", &a);
return a;
}
void f(A &a) { // { dg-error "" } in passing argument
printf("A at %x is %d\n", &a, a.i);
}
int main() {
B b;
b.i = 99;
f(b);// { dg-error "" } .*
}
|