Mercurial > emacs
comparison test/cedet/tests/testtypedefs.cpp @ 104494:e480034314ce
Add Semantic unit tests.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 20 Sep 2009 04:00:13 +0000 |
parents | |
children | 7f4c7f5c0eba |
comparison
equal
deleted
inserted
replaced
104493:a4e1a12c8b97 | 104494:e480034314ce |
---|---|
1 // Sample with some fake bits out of std::string | |
2 // | |
3 // Thanks Ming-Wei Chang for these examples. | |
4 | |
5 namespace std { | |
6 | |
7 template <T>class basic_string { | |
8 | |
9 public: | |
10 void resize(int); | |
11 | |
12 }; | |
13 | |
14 } | |
15 | |
16 typedef std::basic_string<char> mstring; | |
17 | |
18 using namespace std; | |
19 typedef basic_string<char> bstring; | |
20 | |
21 | |
22 int main(){ | |
23 mstring a; | |
24 | |
25 a.// -1- | |
26 ; | |
27 // #1# ( "resize" ) | |
28 | |
29 bstring b; | |
30 // It doesn't work here. | |
31 b.// -2- | |
32 ; | |
33 // #2# ( "resize" ) | |
34 | |
35 return 0; | |
36 } | |
37 | |
38 | |
39 // ------------------ | |
40 | |
41 class Bar | |
42 { | |
43 public: | |
44 void someFunc() {} | |
45 | |
46 }; | |
47 | |
48 typedef Bar new_Bar; | |
49 | |
50 template <class mytype> | |
51 class TBar | |
52 { | |
53 public: | |
54 void otherFunc() {} | |
55 | |
56 }; | |
57 | |
58 typedef TBar<char> new_TBar; | |
59 | |
60 int main() | |
61 { | |
62 new_Bar nb; | |
63 new_TBar ntb; | |
64 | |
65 nb.// -3- | |
66 ; | |
67 // #3# ("someFunc") | |
68 | |
69 ntb.// -4- | |
70 ; | |
71 // #4# ("otherFunc") | |
72 | |
73 return 0; | |
74 } |