blob: 09f9c30a85e7acb64412609e7b9a5b9bb4c9691a (
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
|
// { dg-do assemble }
// { dg-options "-pedantic-errors" }
class Base {
public:
int foo;
};
class Derived : public Base {
public:
int bar;
};
void func(Base&); // { dg-error "passing argument 1" }
void func2(const Derived& d) {
func(d); // { dg-error "invalid initialization" }
}
void
foo (int& a) // { dg-error "in passing argument 1" }
{
}
int main ()
{
int b;
const int*const a = &b;
*a = 10; // { dg-error "read-only location" }
foo (*a); // { dg-error "invalid initialization" }
return 0;
}
|