repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
FSF GCC merge 02/23/03
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.jason
/
net2.C
blob
8738eade438af1a2605f7f280f9a1ec9302b2078
1
// Test of various ?: problems.
2
3
class D
4
{
5
public:
6
void a();
7
void b();
8
D(int i):x(i) {}
9
private:
10
int x;
11
};
12
13
void D::a() {++x;}
14
void D::b() {--x;}
15
16
17
int aa=1, bb=0;
18
19
int fa() {return 0;}
20
int fb() {return 2;}
21
22
int main(int argc, char* argv[])
23
{
24
typedef int* pi;
25
int* p = (argc == 1)? &aa: &bb;
26
*p = 0;
27
28
typedef int (*ifptr)();
29
ifptr fp = (argc == 1)? fa: fb;
30
aa = fp();
31
32
D d(0);
33
typedef void (D::*dmem)();
34
dmem mfp = (argc == 1)? &D::a: &D::b;
35
(d.*mfp)();
36
return 0;
37
}