Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.bugs/900213_03.C

raw
1 // { dg-do assemble }
2 // g++ 1.36.1 bug 900213_03
3
4 // g++ fails to detect an error when the address of a "bound" function is
5 // assigned to a pointer-to-member-function variable.
6
7 // It does however correctly detect a similar errors for data-members.
8
9 // keywords: bound function, operator&, member pointers
10
11 struct struct0 {
12 int data_member;
13 int function_member ();
14 };
15
16 int i;
17 int struct0::*dmp;
18 int (struct0::*fmp) ();
19
20 struct0 *ptr;
21
22 void global_function_0 ()
23 {
24 fmp = &ptr->function_member; // { dg-error "15:ISO C\\+\\+ forbids taking the address of a bound member function" }
25 //dmp = &ptr->data_member; // caught by g++, missed by cfront
26 }
27
28 int main () { return 0; }